lcgdm-1.10.0/0000755000175000017500000000000013234072407012221 5ustar ellertellertlcgdm-1.10.0/dpmcopy/0000755000175000017500000000000013234072401013666 5ustar ellertellertlcgdm-1.10.0/dpmcopy/dpmcopyd.logrotate0000644000175000017500000000043511066421615017437 0ustar ellertellert# # $Id: dpmcopyd.logrotate,v 1.1 2008/09/24 11:25:00 dhsmith Exp $ # # @(#)$RCSfile: dpmcopyd.logrotate,v $ $Revision: 1.1 $ $Date: 2008/09/24 11:25:00 $ CERN/IT/GD/ITR Jean-Philippe Baud # /var/log/dpmcopy/log { compress daily delaycompress missingok rotate 90 } lcgdm-1.10.0/dpmcopy/Imakefile0000644000175000017500000001732112200740514015502 0ustar ellertellertCOMM COMM Copyright (C) 2007-2010 by CERN COMM All rights reserved COMM COMM @(#)$RCSfile: Imakefile,v $ $Revision: 9297 $ $Date: 2013-08-08 18:03:24 +0200 (Thu, 08 Aug 2013) $ CERN Jean-Philippe Baud COMM Make dpmcopyd server DPMSHAREDIR = FileName($(SHAREDIR),lcgdm) #if BuildSecurity CSECFLAG = -DCSEC LIBCSEC = -ldl #if UseVirtualIds VIDFLAG = -DVIRTUAL_ID #endif #if UseVOMS VOMSFLAG = -DUSE_VOMS VOMS_LOCATION=VomsLocation #endif #endif DPMCONFIG = DpmConfigFile GSOAP_LOCATION=GsoapLocation GSOAP_VERSION=GsoapVersion WSDL2H_FLAGS=GsoapWsdl2hFlags CGSI_GSOAP_LOCATION=CgsiGsoapLocation GLOBUS_LOCATION=GlobusLocation #if EMIBuild GLOBUS_INCLUDES=-I$(GLOBUS_LOCATION)/include/globus -I$(GLOBUS_LOCATION)/$(_lib)/globus/include GLOBUS_LIBS=-lglobus_gssapi_gsi -lglobus_gss_assist -lglobus_common GGC_LIB=-L$(GLOBUS_LOCATION)/$(_lib) -lglobus_gass_copy -lglobus_ftp_client -lglobus_common #if UseVOMS VOMS_LIB = -lvomsapi SECLIB = -lcgsi_plugin_voms #else SECLIB = -lcgsi_plugin #endif SOAPLIB = -lgsoap #else GLOBUS_FLAVOUR=GlobusFlavour VOMS_FLAVOUR=GlobusFlavour GLOBUS_INCLUDES=-I$(GLOBUS_LOCATION)/include/$(GLOBUS_FLAVOUR) GLOBUS_LIBS=-L$(GLOBUS_LOCATION)/lib -lglobus_gssapi_gsi_$(GLOBUS_FLAVOUR) -lglobus_gss_assist_$(GLOBUS_FLAVOUR) -lglobus_common_$(GLOBUS_FLAVOUR) GGC_LIB=-lglobus_gass_copy_$(GLOBUS_FLAVOUR) -lglobus_ftp_client_$(GLOBUS_FLAVOUR) -lglobus_common_$(GLOBUS_FLAVOUR) #if UseVOMS VOMS_LIB = -L$(VOMS_LOCATION)/$(_lib) -L$(VOMS_LOCATION)/lib -lvomsapi_$(VOMS_FLAVOUR) SECLIB = -L$(CGSI_GSOAP_LOCATION)/$(_lib) -L$(CGSI_GSOAP_LOCATION)/lib -lcgsi_plugin_voms_gsoap_$(GSOAP_VERSION)_$(GLOBUS_FLAVOUR) $(VOMS_LIB) $(GLOBUS_LIBS) #else SECLIB = -L$(CGSI_GSOAP_LOCATION)/$(_lib) -L$(CGSI_GSOAP_LOCATION)/lib -lcgsi_plugin_gsoap_$(GSOAP_VERSION) $(GLOBUS_LIBS) #endif STDSOAP_OBJS = stdsoap2.Osuf #endif SOAPFLG = -DWITH_IPV6 INCLUDES = FileName(..,h) #if SOLARIS LIBS = -L../shlib -ldpm -llcgdm -lsocket -lnsl #else LIBS = -L../shlib -ldpm -llcgdm #endif SPOOL = DpmcopySpool LOGFILE = FileName($(SPOOL),log) #if UseOracle DBOBJS = dpm_oracle_ifce.Osuf ORAFLG = -DUSE_ORACLE ifdef ORACLE_INCLUDE ORAINC = -I$(ORACLE_INCLUDE) else ORAINC = -I$(ORACLE_HOME)/precomp/public endif #else #if UseMySQL DBOBJS = dpm_mysql_ifce.Osuf MYSFLG = -DUSE_MYSQL MYSQL_LOCATION = MySQLLocation MYSINC = -I$(MYSQL_LOCATION)/include/mysql LIBMYS = -L$(MYSQL_LOCATION)/$(_lib)/mysql -lmysqlclient #else #if UsePostgres DBOBJS = dpm_libpq_ifce.Osuf POSFLG = -DUSE_POSTGRES LIBPOS = -lpq #endif #endif #endif COMM######################### FLAGS ############################## DFLAGS = -DDPMCONFIG=\"$(DPMCONFIG)\" \ -DLOGFILE=\"$(LOGFILE)\" \ $(ORAFLG) $(MYSFLG) $(POSFLG) $(CSECFLAG) $(VIDFLAG) $(VOMSFLAG) $(SOAPFLG) CFLAGS = -g -I$(INCLUDES) -I$(GSOAP_LOCATION)/include -I$(CGSI_GSOAP_LOCATION)/include $(DFLAGS) $(ORAINC) $(MYSINC) $(POSINC) COMM######################### DEPENDENCY LIBRARIES ############### DEPLIB = DepSharedLibraryTargetName(shlib,dpm) COMM######################### RULES ############################## MANPAGES = $(LIBFLAVOURDIR)/dpmcopyd.$(DMONMANSUFFIX) SERVER = ProgramTargetName(dpmcopyd) \ rc.dpmcopyd \ dpmcopyd.conf.templ \ dpmcopyd.logrotate IPROGS_D = FileName($(LIBFLAVOURDIR),ProgramTargetName(dpmcopyd)) \ FileName($(CONFFLAVOURDIR),dpmcopyd.init) \ FileName($(CONFFLAVOURDIR),dpmcopyd.conf) \ FileName($(CONFFLAVOURDIR),dpmcopyd.logrotate) SRV_OBJS = dpmcopy_main.Osuf \ dpmcopy_local.Osuf \ dpmcopy_pull.Osuf \ dpmcopy_push.Osuf \ srmv2_ifce.Osuf \ $(DBOBJS) \ dpm_copyfile.Osuf \ ../dpm/dpm_util.Osuf \ ../dpm/dpmlogit.Osuf \ ../dpm/sendrep.Osuf \ $(STDSOAP_OBJS) \ srmv2C.Osuf \ srmv2Client.Osuf all: $(SERVER) dpm_copyfile.c: DepSourceName(dpm,dpm_copyfile.c) RemoveFile(dpm_copyfile.c) $(CP) DepSourceName(dpm,dpm_copyfile.c) dpm_copyfile.c dpm_libpq_ifce.c: DepSourceName(dpm,dpm_libpq_ifce.c) RemoveFile(dpm_libpq_ifce.c) $(CP) DepSourceName(dpm,dpm_libpq_ifce.c) dpm_libpq_ifce.c dpm_mysql_ifce.c: DepSourceName(dpm,dpm_mysql_ifce.c) RemoveFile(dpm_mysql_ifce.c) $(CP) DepSourceName(dpm,dpm_mysql_ifce.c) dpm_mysql_ifce.c dpm_oracle_ifce.pc: DepSourceName(dpm,dpm_oracle_ifce.pc) RemoveFile(dpm_oracle_ifce.pc) $(CP) DepSourceName(dpm,dpm_oracle_ifce.pc) dpm_oracle_ifce.pc #undef YES dpm_oracle_ifce.c: dpm_oracle_ifce.pc proc INAME=dpm_oracle_ifce INCLUDE=$(INCLUDES) CHAR_MAP=STRING PARSE=FULL $(WNT_SYS_INCLUDE) #define YES 1 srmv2Stub.h srmv2C.c srmv2Client.c srmSoapBinding.nsmap: srmv2H.h srmv2H.h: srm.v2.2.h $(GSOAP_LOCATION)/bin/soapcpp2 -c -p srmv2 srm.v2.2.h srm.v2.2.h: srm.v2.2.wsdl $(GSOAP_LOCATION)/bin/wsdl2h $(WSDL2H_FLAGS) -c -e -y -t typemap.dat srm.v2.2.wsdl dpm_copyfile.Osuf: dpm_copyfile.c $(CC) $(CFLAGS) $(GLOBUS_INCLUDES) -c dpm_copyfile.c dpmcopy_inc_reqctr.Osuf: dpmcopy_inc_reqctr.c $(CC) -c -g -I$(INCLUDES) $(MTCCFLAGS) $(CSECFLAG) dpmcopy_inc_reqctr.c send2dpmcopyd.Osuf: send2dpmcopyd.c $(CC) -c -g -I$(INCLUDES) $(MTCCFLAGS) $(CSECFLAG) send2dpmcopyd.c stdsoap2.Osuf: $(GSOAP_LOCATION)/src/stdsoap2.c $(CC) -c -g -I$(GSOAP_LOCATION)/include $(SOAPFLG) $(GSOAP_LOCATION)/src/stdsoap2.c #if UseOracle && !defined(_WIN32) dpmcopyd: $(SRV_OBJS) $(DEPLIB) $(MAKE) -f oralink.mk dpmcopyd SRV_OBJS="$(SRV_OBJS)" LIBS="$(SOAPLIB) $(GGC_LIB) $(LIBS) $(SECLIB)" #else NormalProgramTarget(dpmcopyd,$(SRV_OBJS), $(DEPLIB), $(SOAPLIB) $(GGC_LIB) $(LIBS) $(SECLIB) $(LIBORA) $(LIBMYS) $(LIBPOS)) #endif #if UseOracle rc.dpmcopyd: dpmcopyd.scripts.oracle sed -e 's#DPMCONFIGFILE=.*#DPMCONFIGFILE=$(DPMCONFIG)#' \ -e 's#PREFIX=.*#PREFIX=$(prefix)#' $? > $@ dpmcopyd.conf.templ: dpmcopyd.sysconfig.oracle sed -e 's#DPMCONFIGFILE=.*#DPMCONFIGFILE="$(DPMCONFIG)"#' $? > $@ #else #if UseMySQL rc.dpmcopyd: dpmcopyd.scripts.mysql sed -e 's#DPMCONFIGFILE=.*#DPMCONFIGFILE=$(DPMCONFIG)#' \ -e 's#PREFIX=.*#PREFIX=$(prefix)#' $? > $@ dpmcopyd.conf.templ: dpmcopyd.sysconfig.mysql sed -e 's#DPMCONFIGFILE=.*#DPMCONFIGFILE="$(DPMCONFIG)"#' $? > $@ #else #if UsePostgres rc.dpmcopyd: dpmcopyd.scripts.postgresql sed -e 's#DPMCONFIGFILE=.*#DPMCONFIGFILE=$(DPMCONFIG)#' \ -e 's#PREFIX=.*#PREFIX=$(prefix)#' $? > $@ dpmcopyd.conf.templ: dpmcopyd.sysconfig.postgresql sed -e 's#DPMCONFIGFILE=.*#DPMCONFIGFILE="$(DPMCONFIG)"#' $? > $@ #endif #endif #endif NormalLibraryTarget(dpmcopy,dpmcopy_inc_reqctr.Osuf send2dpmcopyd.Osuf) install: $(BIN) $(SBIN) $(DPMSHAREDIR) $(SYSCONFDIR) $(INITRCDIR) $(LOGROTATEDIR) $(LIBFLAVOURDIR) $(CONFFLAVOURDIR) $(IPROGS_D) $(SPOOL) InstallProgram(dpmcopyd,$(LIBFLAVOURDIR),root,bin,755) InstallTargetRename(rc.dpmcopyd,root,bin,0755,$(CONFFLAVOURDIR),dpmcopyd.init) InstallTargetRename(dpmcopyd.conf.templ,root,bin,0644,$(CONFFLAVOURDIR),dpmcopyd.conf) InstallTarget(dpmcopyd.logrotate,root,bin,0644,$(CONFFLAVOURDIR)) MakeDir($(BIN),root,bin,0755) MakeDir($(SBIN),root,bin,0755) MakeDir($(DPMSHAREDIR),root,bin,0755) MakeDir($(SPOOL),root,bin,0755) MakeDir($(SYSCONFDIR),root,bin,0755) MakeDir($(INITRCDIR),root,bin,0755) MakeDir($(LOGROTATEDIR),root,bin,0755) MakeDir($(LIBFLAVOURDIR),root,bin,0755) MakeDir($(CONFFLAVOURDIR),root,bin,0755) install.man: $(MANDIR) $(DMONMANDIR) $(MANPAGES) MakeDir($(MANDIR),root,bin,0755) MakeDir($(DMONMANDIR),root,bin,0755) IMANPAGE(dpmcopyd,$(LIBFLAVOURDIR),$(DMONMANSUFFIX)) COMM###################### CLEANING RULES ######################## clean: -@RemoveFiles(FilesToClean *H.h *Object.h *Proxy.h *Stub.h *C.c *Client.c *Lib.c *Server.c *.nsmap *.xml srm.v2.2.h) clobber: clean -@RemoveFiles($(SERVER)) #if _WIN32 depend: @echo Not supported on this platform #else depend: makedepend $(DFLAGS) -Y$(INCLUDES) *.c 2> /dev/null #endif Makefiles: FORCE: COMM###################### DEPENDENCIES ########################## srmv2_ifce.Osuf: srmv2H.h srmSoapBinding.nsmap COMM DO NOT DELETE THIS LINE -- make depend depends on it. lcgdm-1.10.0/dpmcopy/dpmcopyd.sysconfig.postgresql0000644000175000017500000000244512134162334021645 0ustar ellertellert# # $Id: dpmcopyd.sysconfig.postgresql,v 1.2 2009/01/25 23:30:55 szamsu Exp $ # # @(#)$RCSfile: dpmcopyd.sysconfig.postgresql,v $ $Revision: 1.2 $ $Date: 2009/01/25 23:30:55 $ CERN/IT/ADC/CA Jean-Damien Durand # # should the dpmcopyd daemon run? # any string but "yes" will equivalent to "NO" # RUN_DPMCOPYDAEMON="yes" # # should we run with another limit on the number of file descriptors than the default? # any string will be passed to ulimit -n #ULIMIT_N=4096 # ############################################################################################### # Change and uncomment the variables below if your setup is different than the one by default # ############################################################################################### #ALLOW_COREDUMP="yes" ###################### # DPMCOPYD variables # ###################### # - DPM host : please change !!!!!! DPM_HOST= # - DPM Name Server host : please change !!!!!! DPNS_HOST= # - DPMCOPYD log file : #DPMCOPYDLOGFILE="/var/log/dpmcopy/log" # - DPM configuration file : #DPMCONFIGFILE="/opt/lcg/etc/DPMCONFIG" #################### # Globus variables # #################### # - gridmapdir location #GRIDMAPDIR=/etc/grid-security/gridmapdir # - grid-mapfile location #GRIDMAP=/etc/grid-security/grid-mapfile lcgdm-1.10.0/dpmcopy/dpmcopy_local.c0000644000175000017500000002033512245612447016675 0ustar ellertellert/* * Copyright (C) 2007-2008 by CERN/IT/GD/ITR * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: dpmcopy_local.c,v $ $Revision: 1.1 $ $Date: 2008/09/24 11:25:00 $ CERN IT-GD/ITR Jean-Philippe Baud"; #endif /* not lint */ /* dpmcopy_local - copy files when source and target are local */ #include #include #include #include #include #if !defined(_WIN32) #include #endif #include "dpm.h" #include "dpm_api.h" #include "dpm_server.h" #include "dpmcopy_server.h" #include "serrno.h" #define DEFPOLLINT 5 extern int nb_file_err; int dpmcopy_local (struct dpm_dbfd *dbfd, struct dpm_req *dpm_req, struct dpm_copy_filereq *cpr_entry, int nbfiles) { char errbuf[256]; char errstring[256]; struct dpm_filestatus *filestatuses; int *filstatus = NULL; char func[16]; struct dpm_getfilereq *getfilereqs; struct dpm_getfilestatus *getfilestatuses = NULL; int i; int j = 0; int nbgetreplies; int nbputreplies; int nbreplies; char *p; static char *protocols[] = {"gsiftp"}; struct dpm_putfilereq *putfilereqs; struct dpm_putfilestatus *putfilestatus = NULL; char *q; int r = 0; int r1; char r_tokeng[CA_MAXDPMTOKENLEN+1]; char r_tokenp[CA_MAXDPMTOKENLEN+1]; dpm_dbrec_addr rec_addrf; int status; int statusg; strcpy (func, "dpmcopy_local"); if (nbfiles == 0) return (0); /* nothing to be done */ nb_file_err = 0; /* build the get/put requests */ if ((getfilereqs = calloc (nbfiles, sizeof(struct dpm_getfilereq))) == NULL || (putfilereqs = calloc (nbfiles, sizeof(struct dpm_putfilereq))) == NULL || (filstatus = calloc (nbfiles, sizeof(int))) == NULL) { dpm_req->status = DPM_FAILED | ENOMEM; return (-1); } for (i = 0; i < dpm_req->nbreqfiles; i++) { (void) dpm_start_tr (0, dbfd); if (dpm_get_cpr_by_fullid (dbfd, dpm_req->r_token, i, cpr_entry, 1, &rec_addrf) < 0) { dpm_abort_tr (dbfd); continue; } if (cpr_entry->status != DPM_QUEUED) { /* No need to process */ dpm_abort_tr (dbfd); if (cpr_entry->status == DPM_ABORTED || (cpr_entry->status & 0xF000) == DPM_FAILED) nb_file_err++; continue; } if ((p = strdup (cpr_entry->from_surl)) == NULL || (q = strdup (cpr_entry->to_surl)) == NULL) { cpr_entry->status = DPM_FAILED | ENOMEM; (void) upd_cpr (dbfd, &rec_addrf, cpr_entry); continue; } cpr_entry->status = DPM_ACTIVE; (void) upd_cpr (dbfd, &rec_addrf, cpr_entry); (getfilereqs+j)->from_surl = p; (putfilereqs+j)->to_surl = q; (putfilereqs+j)->f_lifetime = cpr_entry->f_lifetime; (putfilereqs+j)->f_type = cpr_entry->f_type == '_' ? '\0' : cpr_entry->f_type; strcpy ((putfilereqs+j)->s_token, cpr_entry->s_token); (putfilereqs+j)->ret_policy = cpr_entry->ret_policy == '_' ? '\0' : cpr_entry->ret_policy; (putfilereqs+j)->ac_latency = cpr_entry->ac_latency == '_' ? '\0' : cpr_entry->ac_latency; j++; } if (j == 0) return (0); /* nothing to be done */ dpm_seterrbuf (errbuf, sizeof(errbuf)); /* get source TURL(s) */ dpmlogit (func, "calling dpm_get\n"); errbuf[0] = '\0'; *r_tokeng = '\0'; statusg = dpm_get (j, getfilereqs, 1, protocols, NULL, dpm_req->retrytime, r_tokeng, &nbgetreplies, &getfilestatuses); if (*r_tokeng) dpmlogit (func, "dpm_get returned request token %s\n", r_tokeng); /* wait for any source TURL ready */ while (1) { for (i = 0; i < j; i++) { if (*(filstatus+i)) continue; /* already processed */ if (! getfilestatuses) { if (statusg < 0) { *(filstatus+i) = DPM_FAILED | serrno; dpmcopy_set_errstring ("get failed", errbuf, NULL, errstring, sizeof(errstring)); (void) upd_cpr2 (dbfd, dpm_req->r_token, (getfilereqs+i)->from_surl, (putfilereqs+i)->to_surl, 0, *(filstatus+i), errstring, 0, cpr_entry); } continue; } if (statusg >= 0 && ((getfilestatuses+i)->status == DPM_QUEUED || (getfilestatuses+i)->status == DPM_ACTIVE)) continue; if ((getfilestatuses+i)->status != DPM_READY) { if ((getfilestatuses+i)->status < DPM_READY) *(filstatus+i) = statusg < 0 ? (DPM_FAILED | serrno) : statusg; else *(filstatus+i) = (getfilestatuses+i)->status; dpmcopy_set_errstring ("get failed", errbuf, (getfilestatuses+i)->errstring, errstring, sizeof(errstring)); (void) upd_cpr2 (dbfd, dpm_req->r_token, (getfilereqs+i)->from_surl, (putfilereqs+i)->to_surl, 0, *(filstatus+i), errstring, 0, cpr_entry); continue; } /* source TURL ready */ (putfilereqs+i)->requested_size = (getfilestatuses+i)->filesize; /* get destination TURL */ errbuf[0] = '\0'; r1 = 0; putfilestatus = NULL; *r_tokenp = '\0'; dpmlogit (func, "calling dpm_put\n"); status = dpm_put (1, putfilereqs+i, 1, protocols, NULL, (dpm_req->flags & 1), dpm_req->retrytime, r_tokenp, &nbputreplies, &putfilestatus); if (*r_tokenp) dpmlogit (func, "dpm_put returned request token %s\n", r_tokenp); /* wait for destination TURL ready */ while (status == DPM_QUEUED || status == DPM_ACTIVE) { dpm_free_pfilest (nbputreplies, putfilestatus); sleep ((r1++ == 0) ? 1 : DEFPOLLINT); errbuf[0] = '\0'; putfilestatus = NULL; status = dpm_getstatus_putreq (r_tokenp, 0, NULL, &nbputreplies, &putfilestatus); } if (! putfilestatus) { *(filstatus+i) = status < 0 ? (DPM_FAILED | serrno) : status; dpmcopy_set_errstring ("put failed", errbuf, NULL, errstring, sizeof(errstring)); goto upd_cfr; } if (putfilestatus->status != DPM_READY) { if (putfilestatus->status < DPM_FAILED) *(filstatus+i) = status < 0 ? (DPM_FAILED | serrno) : status; else *(filstatus+i) = putfilestatus->status; dpmcopy_set_errstring ("put failed", errbuf, putfilestatus->errstring, errstring, sizeof(errstring)); goto upd_cfr; } /* destination TURL ready, copy file */ errbuf[0] = '\0'; *(filstatus+i) = DPM_ACTIVE; dpmlogit (func, "copying %s to %s\n", (getfilestatuses+i)->turl, putfilestatus->turl); status = dpm_copyfile ((getfilestatuses+i)->turl, putfilestatus->turl, 5, 0); filestatuses = NULL; if (status < 0) { dpmlogit (func, "dpm_copyfile returned %d, serrno = %d\n", status, serrno); status = DPM_FAILED | serrno; dpmcopy_set_errstring ("copy failed", errbuf, NULL, errstring, sizeof(errstring)); (void) dpm_abortfiles (r_tokenp, 1, &putfilestatus->to_surl, &nbreplies, &filestatuses); } else { dpmlogit (func, "dpm_copyfile returned %d\n", status); errbuf[0] = '\0'; dpmlogit (func, "calling dpm_putdone\n"); status = dpm_putdone (r_tokenp, 1, &putfilestatus->to_surl, &nbreplies, &filestatuses); if (status < 0) { status = DPM_FAILED | serrno; dpmcopy_set_errstring ("putdone failed", errbuf, NULL, errstring, sizeof(errstring)); } else errstring[0] = '\0'; } dpm_free_filest (nbreplies, filestatuses); *(filstatus+i) = status ? status : DPM_DONE; /* try to get target SURL lifetime */ if (status == 0) { dpm_free_pfilest (nbputreplies, putfilestatus); putfilestatus = NULL; if (dpm_getstatus_putreq (r_tokenp, 0, NULL, &nbputreplies, &putfilestatus) == 0 && putfilestatus) cpr_entry->f_lifetime = putfilestatus->f_lifetime; } upd_cfr: filestatuses = NULL; (void) dpm_relfiles (r_tokeng, 1, &(getfilestatuses+i)->from_surl, 0, &nbreplies, &filestatuses); dpm_free_filest (nbreplies, filestatuses); (void) upd_cpr2 (dbfd, dpm_req->r_token, (getfilereqs+i)->from_surl, (putfilereqs+i)->to_surl, (*(filstatus+i) == DPM_DONE) ? (getfilestatuses+i)->filesize : 0, (*(filstatus+i) == DPM_DONE) ? 0 : *(filstatus+i), errstring, cpr_entry->f_lifetime, cpr_entry); dpm_free_pfilest (nbputreplies, putfilestatus); } for (i = 0; i < j; i++) { if (*(filstatus+i) == 0 || *(filstatus+i) == DPM_ACTIVE) break; } if (i >= j) break; /* no more pending file request */ dpm_free_gfilest (nbgetreplies, getfilestatuses); getfilestatuses = NULL; errbuf[0] = '\0'; sleep ((r++ == 0) ? 1 : DEFPOLLINT); statusg = dpm_getstatus_getreq (r_tokeng, 0, NULL, &nbgetreplies, &getfilestatuses); } return (0); } lcgdm-1.10.0/dpmcopy/dpmcopyd.scripts.mysql0000644000175000017500000002013711763665646020315 0ustar ellertellert#!/bin/sh # # dpmcopyd Start/Stop dpmcopyd # # chkconfig: - 93 17 # description: DPM COPY server daemon # # $Id: dpmcopyd.scripts.mysql 6384 2012-06-06 14:39:34Z rocha $ # # @(#)$RCSfile: dpmcopyd.scripts.mysql,v $ $Revision: 6384 $ $Date: 2012-06-06 16:39:34 +0200 (Wed, 06 Jun 2012) $ CERN/IT/ADC/CA Jean-Damien Durand # # ## PLEASE USE sysconfig FILE TO CHANGE THESE ENVIRONMENT VARIABLES # PREFIX=/opt/lcg GRIDMAPDIR=/etc/grid-security/gridmapdir export GRIDMAPDIR GRIDMAP=/etc/grid-security/grid-mapfile export GRIDMAP LD_LIBRARY_PATH=/opt/glite/lib:/opt/globus/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH CSEC_MECH=ID export CSEC_MECH DPMCOPYDLOGFILE=/var/log/dpmcopy/log DPMCONFIGFILE=/opt/lcg/etc/DPMCONFIG DPMUSER=dpmmgr DPMGROUP=dpmmgr sysname=`uname -s` # source function library if [ -r /etc/rc.d/init.d/functions ]; then . /etc/rc.d/init.d/functions DAEMON="daemon --check dpmcopyd" FAILURE=failure ECHO_FAILURE=echo_failure SUCCESS=success ECHO_SUCCESS=echo_success ECHO_END=echo if [ $sysname = "Linux" ]; then ECHOOPT=-n fi else DAEMON=eval FAILURE= ECHO_FAILURE= SUCCESS= ECHO_SUCCESS= ECHOOPT= ECHO_END= fi RETVAL=0 prog="dpmcopyd" PIDFILE=/var/run/dpmcopyd.pid PIDDIR=/var/run SUBSYS=/var/lock/subsys/dpmcopyd SUBSYSDIR=/var/lock/subsys [ -z "$SILENTSTOP" ] && SILENTSTOP=0 DPMCOPYD=$PREFIX/sbin/dpmcopyd DPMCOPYSHUTDOWN=$PREFIX/sbin/dpmcopy-shutdown if [ -r $PREFIX/etc/dpmcopyd.conf ]; then SYSCONFIGDPMCOPYD=$PREFIX/etc/dpmcopyd.conf elif [ -r /etc/sysconfig/dpmcopyd ]; then SYSCONFIGDPMCOPYD=/etc/sysconfig/dpmcopyd elif [ -r /etc/default/dpmcopyd ]; then SYSCONFIGDPMCOPYD=/etc/default/dpmcopyd fi # ## Blindly attempt to create useful directories # # [ ! -d $PIDDIR ] && mkdir -p $PIDDIR > /dev/null 2>&1 # [ ! -d $SUBSYSDIR ] && mkdir -p $SUBSYSDIR > /dev/null 2>&1 if [ $sysname = "HP-UX" ]; then export UNIX95=1 fi if [ $sysname = "SunOS" ]; then format4comm="fname" elif [ $sysname = "Darwin" ]; then format4comm="ucomm" else format4comm="comm" fi case "$1" in start) DPMUSERHOME=`finger $DPMUSER | grep -i directory: | cut -f 2 -d' '` X509_USER_CERT=/etc/grid-security/$DPMUSER/dpmcert.pem export X509_USER_CERT X509_USER_KEY=/etc/grid-security/$DPMUSER/dpmkey.pem export X509_USER_KEY netstat -an | egrep '[:.]5017' | egrep 'LISTEN *$' > /dev/null if [ $? -eq 0 ]; then echo $ECHOOPT "dpmcopyd already started: " [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "dpmcopyd already started: " RETVAL=0 else if [ -n "$SYSCONFIGDPMCOPYD" ]; then # ## Source the configuration # . $SYSCONFIGDPMCOPYD if [ "${RUN_DPMCOPYDAEMON}" != "yes" ]; then echo $ECHOOPT "$SYSCONFIGDPMCOPYD says NO: " [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "$SYSCONFIGDPMCOPYD says NO: " RETVAL=0 $ECHO_END exit $RETVAL fi export DPM_HOST export DPNS_HOST if [ -n "${ULIMIT_N}" ]; then ulimit -n ${ULIMIT_N} fi fi if [ ! -s "$DPMCONFIGFILE" ]; then echo $ECHOOPT "config file $DPMCONFIGFILE empty: " [ -n "$ECHO_FAILURE" ] && $ECHO_FAILURE "config file $DPMCONFIGFILE empty: " RETVAL=1 fi if [ $RETVAL -eq 0 ]; then echo $ECHOOPT "Starting $prog: " cd / mkdir -p `dirname $DPMCOPYDLOGFILE` chown $DPMUSER:$DPMGROUP `dirname $DPMCOPYDLOGFILE` if [ "${ALLOW_COREDUMP}" != "yes" ]; then $DAEMON "su $DPMUSER -c \"LD_LIBRARY_PATH=$LD_LIBRARY_PATH $DPMCOPYD -c $DPMCONFIGFILE -l $DPMCOPYDLOGFILE\"" else $DAEMON "su $DPMUSER -c \"mkdir -p $DPMUSERHOME/dpmcopy; cd $DPMUSERHOME/dpmcopy; hostname -f >> logstart; date >> logstart; umask 0; umask >> logstart; ulimit -c unlimited; pwd >> logstart; ulimit -c >> logstart; echo DAEMON $DPMCOPYD \`hostname -f\` >> logstart; LD_LIBRARY_PATH=$LD_LIBRARY_PATH $DPMCOPYD -c $DPMCONFIGFILE -l $DPMCOPYDLOGFILE\"" fi if [ $? -eq 0 ]; then [ -d $SUBSYSDIR ] && touch $SUBSYS if [ -d $PIDDIR ]; then pid=`ps -eo pid,ppid,$format4comm | grep " 1 dpmcopyd$" | awk '{print $1}'` # The point of $PIDFILE is that it kills only # the master daemon. rm -f $PIDFILE echo $pid > $PIDFILE fi [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "Starting $prog: " RETVAL=0 else [ -n "$ECHO_FAILURE" ] && $ECHO_FAILURE "Starting $prog: " RETVAL=1 fi fi fi $ECHO_END ;; stop) if [ -f $PIDFILE ]; then echo $ECHOOPT "Stopping $prog: " if [ -x $DPMCOPYSHUTDOWN ]; then $DPMCOPYSHUTDOWN -f -h `hostname` > /dev/null 2>&1 RETVAL=$? if [ $RETVAL -ne 0 ]; then kill -2 -`cat $PIDFILE` > /dev/null 2>&1 RETVAL=$? fi else kill -2 -`cat $PIDFILE` > /dev/null 2>&1 RETVAL=$? fi if [ $RETVAL -eq 0 ]; then rm -f $PIDFILE [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "Stopping $prog: " else [ -n "$ECHO_FAILURE" ] && $ECHO_FAILURE "Stopping $prog: " fi else # dpmcopyd might have been started by hand pid=`ps -eo pid,ppid,$format4comm | grep " 1 dpmcopyd$" | awk '{print $1}'` if [ -n "$pid" ]; then echo $ECHOOPT "Stopping $prog: " if [ -x $DPMCOPYSHUTDOWN ]; then $DPMCOPYSHUTDOWN -f -h `hostname` > /dev/null 2>&1 RETVAL=$? if [ $RETVAL -ne 0 ]; then kill -2 -$pid > /dev/null 2>&1 RETVAL=$? fi else kill -2 -$pid > /dev/null 2>&1 RETVAL=$? fi if [ $RETVAL -eq 0 ]; then [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "Stopping $prog: " else [ -n "$ECHO_FAILURE" ] && $ECHO_FAILURE "Stopping $prog: " fi else echo $ECHOOPT "dpmcopyd already stopped: " [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "dpmcopyd already stopped: " [ $SILENTSTOP -eq 0 ] && RETVAL=0 || RETVAL=1 fi fi lpid="X" while [ "x$lpid" != "x" ]; do sleep 1 #Does not seem to work on SunOS ;-) lpid=`ps -eo pid,ppid,$format4comm | grep " 1 dpmcopyd$" | awk '{print $1}'` done [ -d $SUBSYSDIR ] && rm -f $SUBSYS $ECHO_END ;; restart | force-reload) $0 stop if [ $? -eq 0 -o $SILENTSTOP -eq 0 ]; then sleep 1 $0 start RETVAL=$? else RETVAL=0 fi ;; condrestart | try-restart) SILENTSTOP=1 export SILENTSTOP $0 restart RETVAL=$? ;; reload) ;; status) pid=`ps -eo pid,ppid,$format4comm | grep " 1 dpmcopyd$" | awk '{print $1}'` if [ -n "$pid" ]; then echo $ECHOOPT "dpmcopyd (pid $pid) is running..." $ECHO_SUCCESS $ECHO_END RETVAL=0 else if [ -f $PIDFILE ]; then pid=`head -1 $PIDFILE` if [ "$pid" != "" ] ; then echo $ECHOOPT "dpmcopyd dead but pid file exists" $ECHO_FAILURE $ECHO_END RETVAL=1 else echo $ECHOOPT "dpmcopyd dead" $ECHO_FAILURE $ECHO_END RETVAL=1 fi else if [ -f $SUBSYS ]; then echo $ECHOOPT "dpmcopyd dead but subsys ($SUBSYS) locked" RETVAL=2 else echo $ECHOOPT "dpmcopyd is stopped" RETVAL=3 fi $ECHO_FAILURE $ECHO_END fi fi ;; *) echo "Usage: $0 {start|stop|status|restart|condrestart}" RETVAL=1 ;; esac exit $RETVAL lcgdm-1.10.0/dpmcopy/typemap.dat0000644000175000017500000000004211066421615016041 0ustar ellertellertxsd__dateTime = | char * | char * lcgdm-1.10.0/dpmcopy/dpmcopy_push.c0000644000175000017500000002113612245612447016562 0ustar ellertellert/* * Copyright (C) 2007-2008 by CERN/IT/GD/ITR * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: dpmcopy_push.c,v $ $Revision: 1.1 $ $Date: 2008/09/24 11:25:00 $ CERN IT-GD/ITR Jean-Philippe Baud"; #endif /* not lint */ /* dpmcopy_push - copy files when source is local and target is remote */ #include #include #include #include #include #if !defined(_WIN32) #include #endif #include "dpm.h" #include "dpm_api.h" #include "dpm_server.h" #include "dpmcopy_server.h" #include "serrno.h" #define DEFPOLLINT 5 extern int nb_file_err; int dpmcopy_push (struct dpm_dbfd *dbfd, struct dpm_req *dpm_req, struct dpm_copy_filereq *cpr_entry, int nbfiles) { char errbuf[256]; char errstring[256]; struct dpm_filestatus *filestatuses; int *filstatus = NULL; char func[16]; struct dpm_getfilereq *getfilereqs; struct dpm_getfilestatus *getfilestatuses = NULL; int i; int j = 0; int nbgetreplies; int nbputreplies; int nbreplies; char *p; static char *protocols[] = {"gsiftp"}; struct dpm_putfilereq *putfilereqs; struct dpm_putfilestatus *putfilestatus = NULL; char *q; int r = 0; int r1; char r_tokeng[CA_MAXDPMTOKENLEN+1]; char *r_tokenp; dpm_dbrec_addr rec_addrf; char srm_endpoint[256]; int status; int statusg; strcpy (func, "dpmcopy_push"); if (nbfiles == 0) return (0); /* nothing to be done */ nb_file_err = 0; /* build the get/put requests */ if ((getfilereqs = calloc (nbfiles, sizeof(struct dpm_getfilereq))) == NULL || (putfilereqs = calloc (nbfiles, sizeof(struct dpm_putfilereq))) == NULL || (filstatus = calloc (nbfiles, sizeof(int))) == NULL) { dpm_req->status = DPM_FAILED | ENOMEM; return (-1); } for (i = 0; i < dpm_req->nbreqfiles; i++) { (void) dpm_start_tr (0, dbfd); if (dpm_get_cpr_by_fullid (dbfd, dpm_req->r_token, i, cpr_entry, 1, &rec_addrf) < 0) { dpm_abort_tr (dbfd); continue; } if (cpr_entry->status != DPM_QUEUED) { /* No need to process */ dpm_abort_tr (dbfd); if (cpr_entry->status == DPM_ABORTED || (cpr_entry->status & 0xF000) == DPM_FAILED) nb_file_err++; continue; } if ((p = strdup (cpr_entry->from_surl)) == NULL || (q = strdup (cpr_entry->to_surl)) == NULL) { cpr_entry->status = DPM_FAILED | ENOMEM; (void) upd_cpr (dbfd, &rec_addrf, cpr_entry); continue; } cpr_entry->status = DPM_ACTIVE; (void) upd_cpr (dbfd, &rec_addrf, cpr_entry); (getfilereqs+j)->from_surl = p; (putfilereqs+j)->to_surl = q; (putfilereqs+j)->f_lifetime = cpr_entry->f_lifetime; (putfilereqs+j)->f_type = cpr_entry->f_type == '_' ? '\0' : cpr_entry->f_type; strcpy ((putfilereqs+j)->s_token, cpr_entry->s_token); (putfilereqs+j)->ret_policy = cpr_entry->ret_policy == '_' ? '\0' : cpr_entry->ret_policy; (putfilereqs+j)->ac_latency = cpr_entry->ac_latency == '_' ? '\0' : cpr_entry->ac_latency; j++; } if (j == 0) return (0); /* nothing to be done */ dpm_seterrbuf (errbuf, sizeof(errbuf)); if (get_srm_endpoint (putfilereqs->to_surl, srm_endpoint, sizeof(srm_endpoint)) < 0) { dpm_req->status = DPM_FAILED | EINVAL; strcpy (dpm_req->errstring, "SRM endpoint too long"); return (-1); } /* get source TURL(s) */ dpmlogit (func, "calling dpm_get\n"); errbuf[0] = '\0'; *r_tokeng = '\0'; statusg = dpm_get (j, getfilereqs, 1, protocols, NULL, dpm_req->retrytime, r_tokeng, &nbgetreplies, &getfilestatuses); if (*r_tokeng) dpmlogit (func, "dpm_get returned request token %s\n", r_tokeng); /* wait for any source TURL ready */ while (1) { for (i = 0; i < j; i++) { if (*(filstatus+i)) continue; /* already processed */ if (! getfilestatuses) { if (statusg < 0) { *(filstatus+i) = DPM_FAILED | serrno; dpmcopy_set_errstring ("get failed", errbuf, NULL, errstring, sizeof(errstring)); (void) upd_cpr2 (dbfd, dpm_req->r_token, (getfilereqs+i)->from_surl, (putfilereqs+i)->to_surl, 0, *(filstatus+i), errstring, 0, cpr_entry); } continue; } if (statusg >= 0 && ((getfilestatuses+i)->status == DPM_QUEUED || (getfilestatuses+i)->status == DPM_ACTIVE)) continue; if ((getfilestatuses+i)->status != DPM_READY) { if ((getfilestatuses+i)->status < DPM_READY) *(filstatus+i) = statusg < 0 ? (DPM_FAILED | serrno) : statusg; else *(filstatus+i) = (getfilestatuses+i)->status; dpmcopy_set_errstring ("get failed", errbuf, (getfilestatuses+i)->errstring, errstring, sizeof(errstring)); (void) upd_cpr2 (dbfd, dpm_req->r_token, (getfilereqs+i)->from_surl, (putfilereqs+i)->to_surl, 0, *(filstatus+i), errstring, 0, cpr_entry); continue; } /* source TURL ready */ (putfilereqs+i)->requested_size = (getfilestatuses+i)->filesize; /* get destination TURL */ errbuf[0] = '\0'; r1 = 0; putfilestatus = NULL; r_tokenp = NULL; dpmlogit (func, "calling srmv2_put\n"); status = srmv2_put (1, putfilereqs+i, 1, protocols, (dpm_req->flags & 1), dpm_req->retrytime, &r_tokenp, &nbputreplies, &putfilestatus); if (r_tokenp) dpmlogit (func, "srmv2_put returned request token %s\n", r_tokenp); /* wait for destination TURL ready */ while (status == DPM_QUEUED || status == DPM_ACTIVE) { dpm_free_pfilest (nbputreplies, putfilestatus); sleep ((r1++ == 0) ? 1 : DEFPOLLINT); errbuf[0] = '\0'; putfilestatus = NULL; status = srmv2_getstatus_putreq (r_tokenp, 0, NULL, srm_endpoint, &nbputreplies, &putfilestatus, dpm_req->retrytime); } if (! putfilestatus) { *(filstatus+i) = status < 0 ? (DPM_FAILED | serrno) : status; dpmcopy_set_errstring ("put failed", errbuf, NULL, errstring, sizeof(errstring)); goto upd_cfr; } if (putfilestatus->status != DPM_READY) { if (putfilestatus->status < DPM_FAILED) *(filstatus+i) = status < 0 ? (DPM_FAILED | serrno) : status; else *(filstatus+i) = putfilestatus->status; dpmcopy_set_errstring ("put failed", errbuf, putfilestatus->errstring, errstring, sizeof(errstring)); goto upd_cfr; } /* destination TURL ready, copy file */ errbuf[0] = '\0'; *(filstatus+i) = DPM_ACTIVE; dpmlogit (func, "copying %s to %s\n", (getfilestatuses+i)->turl, putfilestatus->turl); status = dpm_copyfile ((getfilestatuses+i)->turl, putfilestatus->turl, 5, 0); filestatuses = NULL; if (status < 0) { dpmlogit (func, "dpm_copyfile returned %d, serrno = %d\n", status, serrno); status = DPM_FAILED | serrno; dpmcopy_set_errstring ("copy failed", errbuf, NULL, errstring, sizeof(errstring)); (void) srmv2_abortfiles (r_tokenp, 1, &putfilestatus->to_surl, &nbreplies, &filestatuses, dpm_req->retrytime); } else { dpmlogit (func, "dpm_copyfile returned %d\n", status); errbuf[0] = '\0'; dpmlogit (func, "calling srmv2_putdone\n"); status = srmv2_putdone (r_tokenp, 1, &putfilestatus->to_surl, &nbreplies, &filestatuses, dpm_req->retrytime); if (status < 0) { status = DPM_FAILED | serrno; dpmcopy_set_errstring ("putdone failed", errbuf, NULL, errstring, sizeof(errstring)); } else errstring[0] = '\0'; } dpm_free_filest (nbreplies, filestatuses); *(filstatus+i) = status ? status : DPM_DONE; /* try to get target SURL lifetime */ if (status == 0) { dpm_free_pfilest (nbputreplies, putfilestatus); putfilestatus = NULL; if (srmv2_getstatus_putreq (r_tokenp, 0, NULL, srm_endpoint, &nbputreplies, &putfilestatus, dpm_req->retrytime) == 0 && putfilestatus) cpr_entry->f_lifetime = putfilestatus->f_lifetime; } upd_cfr: filestatuses = NULL; (void) dpm_relfiles (r_tokeng, 1, &(getfilestatuses+i)->from_surl, 0, &nbreplies, &filestatuses); dpm_free_filest (nbreplies, filestatuses); (void) upd_cpr2 (dbfd, dpm_req->r_token, (getfilereqs+i)->from_surl, (putfilereqs+i)->to_surl, (*(filstatus+i) == DPM_DONE) ? (getfilestatuses+i)->filesize : 0, (*(filstatus+i) == DPM_DONE) ? 0 : *(filstatus+i), errstring, cpr_entry->f_lifetime, cpr_entry); dpm_free_pfilest (nbputreplies, putfilestatus); if (r_tokenp) free (r_tokenp); } for (i = 0; i < j; i++) { if (*(filstatus+i) == 0 || *(filstatus+i) == DPM_ACTIVE) break; } if (i >= j) break; /* no more pending file request */ dpm_free_gfilest (nbgetreplies, getfilestatuses); getfilestatuses = NULL; errbuf[0] = '\0'; sleep ((r++ == 0) ? 1 : DEFPOLLINT); statusg = dpm_getstatus_getreq (r_tokeng, 0, NULL, &nbgetreplies, &getfilestatuses); } return (0); } lcgdm-1.10.0/dpmcopy/srmv2_ifce.c0000644000175000017500000006367111066421615016114 0ustar ellertellert/* * Copyright (C) 2007 by CERN/IT/GD/ITR * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: srmv2_ifce.c,v $ $Revision: 1.1 $ $Date: 2008/09/24 11:25:00 $ CERN IT-GD/ITR Jean-Philippe Baud"; #endif /* not lint */ #include #include #include "cgsi_plugin.h" #include "dpm.h" #include "dpm_api.h" #include "dpm_server.h" #include "dpmcopy_server.h" #include "serrno.h" #include "srmv2H.h" #include "srmSoapBinding.nsmap" static enum ns1__TAccessLatency al_types[] = {ONLINE, NEARLINE}; static enum ns1__TOverwriteMode o_modes[] = {NEVER, ALWAYS}; static enum ns1__TFileStorageType s_types[] = {VOLATILE, DURABLE, PERMANENT}; #define SRM_SERVICE_PATH "/srm/managerv2" int get_srm_endpoint(char *surl, char *epbuf, int epbufsz) { char *p; if ((p = strstr (surl + 6, "?SFN="))) { /* full endpoint is provided */ if (p - surl + 3 > epbufsz) return (-1); strcpy (epbuf, "httpg"); strncpy (epbuf + 5, surl + 3, p - surl - 3); *(epbuf + (p - surl + 2)) = '\0'; } else { if ((p = strchr (surl + 6, '/')) == NULL) return (-1); if (p - surl + 2 + sizeof(SRM_SERVICE_PATH) > epbufsz) return (-1); strcpy (epbuf, "httpg"); strncpy (epbuf + 5, surl + 3, p - surl - 3); *(epbuf + (p - surl + 2)) = '\0'; strcat (epbuf, SRM_SERVICE_PATH); } return (0); } int soap_error2serrno(struct soap *soap) { if (soap->error == SOAP_EOM) return (ENOMEM); else if (soap->error == SOAP_EOF) return (SETIMEDOUT); else { if (soap->fault && soap->fault->faultstring) { dpm_errmsg (NULL, "%s\n", soap->fault->faultstring); if (strstr (soap->fault->faultstring, "credential")) return (ESEC_BAD_CREDENTIALS); else return (EINVAL); } else return (SEINTERNAL); } } int statuscode2serrno(int statuscode) { switch (statuscode) { case SRM_USCOREAUTHENTICATION_USCOREFAILURE: return (ESEC_BAD_CREDENTIALS); case SRM_USCOREAUTHORIZATION_USCOREFAILURE: return (EACCES); case SRM_USCOREINVALID_USCOREREQUEST: return (EINVAL); case SRM_USCOREINVALID_USCOREPATH: return (ENOENT); case SRM_USCORESPACE_USCORELIFETIME_USCOREEXPIRED: dpm_errmsg (NULL, "Space lifetime expired\n"); return (EINVAL); case SRM_USCORENO_USCOREFREE_USCORESPACE: return (ENOSPC); case SRM_USCOREDUPLICATION_USCOREERROR: return (EEXIST); case SRM_USCOREINTERNAL_USCOREERROR: return (SEINTERNAL); case SRM_USCORENOT_USCORESUPPORTED: return (SEOPNOTSUP); default: return (EINVAL); } } int statuscode2dpmstatus(int statuscode, int isfile) { switch (statuscode) { case SRM_USCORESUCCESS: return (DPM_SUCCESS); case SRM_USCOREFILE_USCORELIFETIME_USCOREEXPIRED: return (DPM_EXPIRED); case SRM_USCOREREQUEST_USCOREQUEUED: return (DPM_QUEUED); case SRM_USCOREREQUEST_USCOREINPROGRESS: return (DPM_ACTIVE); case SRM_USCOREABORTED: return (DPM_ABORTED); case SRM_USCORERELEASED: return (DPM_RELEASED); case SRM_USCOREFILE_USCOREPINNED: return (DPM_READY); case SRM_USCOREFILE_USCOREIN_USCORECACHE: return (DPM_SUCCESS); case SRM_USCORESPACE_USCOREAVAILABLE: return (DPM_READY); case SRM_USCOREPARTIAL_USCORESUCCESS: return (DPM_DONE); default: if (isfile) return (DPM_FAILED | statuscode2serrno (statuscode)); serrno = statuscode2serrno (statuscode); return (-1); } } int srmv2_init(struct soap *soap, int timeout) { int flags; soap_init (soap); flags = CGSI_OPT_DISABLE_NAME_CHECK; soap_register_plugin_arg (soap, client_cgsi_plugin, &flags); soap->connect_timeout = timeout ; soap->send_timeout = timeout ; soap->recv_timeout = timeout ; return (0); } int srmv2_abortfiles(char *r_token, int nbsurls, char **surls, int *nbreplies, struct dpm_filestatus **filestatuses, int timeout) { int i; struct ns1__srmAbortFilesResponse_ rep; struct ns1__ArrayOfTSURLReturnStatus *repfs; struct ns1__srmAbortFilesRequest req; struct ns1__TReturnStatus *reqstatp; struct soap soap; char srm_endpoint[256]; int status; if (get_srm_endpoint (surls[0], srm_endpoint, sizeof(srm_endpoint)) < 0) { dpm_errmsg (NULL, "SRM endpoint too long\n"); return (-1); } srmv2_init (&soap, timeout); memset (&req, 0, sizeof(req)); req.requestToken = r_token; if ((req.arrayOfSURLs = soap_malloc (&soap, sizeof(struct ns1__ArrayOfAnyURI))) == NULL || (req.arrayOfSURLs->urlArray = soap_malloc (&soap, nbsurls * sizeof(char *))) == NULL) { serrno = ENOMEM; soap_end (&soap); soap_done (&soap); return (-1); } req.arrayOfSURLs->__sizeurlArray = nbsurls; for (i = 0; i < nbsurls; i++) { req.arrayOfSURLs->urlArray[i] = surls[i]; } if (soap_call_ns1__srmAbortFiles (&soap, srm_endpoint, "AbortFiles", &req, &rep)) { serrno = soap_error2serrno (&soap); soap_end (&soap); soap_done (&soap); return (-1); } reqstatp = rep.srmAbortFilesResponse->returnStatus; repfs = rep.srmAbortFilesResponse->arrayOfFileStatuses; if (! repfs || repfs->__sizestatusArray <= 0 || ! repfs->statusArray) { *filestatuses = NULL; } else if ((*filestatuses = malloc (repfs->__sizestatusArray * sizeof(struct dpm_filestatus)))) { *nbreplies = repfs->__sizestatusArray; for (i = 0; i < *nbreplies; i++) { (*filestatuses+i)->surl = strdup (repfs->statusArray[i]->surl); (*filestatuses+i)->status = statuscode2dpmstatus (repfs->statusArray[i]->status->statusCode, 1); if (repfs->statusArray[i]->status->explanation) (*filestatuses+i)->errstring = strdup (repfs->statusArray[i]->status->explanation); else (*filestatuses+i)->errstring = NULL; } } if (reqstatp->explanation) dpm_errmsg (NULL, "%s\n", reqstatp->explanation); status = statuscode2dpmstatus (reqstatp->statusCode, 0); soap_end (&soap); soap_done (&soap); return (status); } int srmv2_get(int nbfiles, char **surls, int nbprotocols, char **protocols, int timeout, char **r_token, int *nbreplies, struct dpm_getfilestatus **filestatuses) { int i; struct ns1__srmPrepareToGetResponse_ rep; struct ns1__ArrayOfTGetRequestFileStatus *repfs; struct ns1__srmPrepareToGetRequest req; struct ns1__TReturnStatus *reqstatp; struct soap soap; char srm_endpoint[256]; int status; if (get_srm_endpoint (surls[0], srm_endpoint, sizeof(srm_endpoint)) < 0) { dpm_errmsg (NULL, "SRM endpoint too long\n"); return (-1); } srmv2_init (&soap, timeout); memset (&req, 0, sizeof(req)); if ((req.arrayOfFileRequests = soap_malloc (&soap, sizeof(struct ns1__ArrayOfTGetFileRequest))) == NULL || (req.arrayOfFileRequests->requestArray = soap_malloc (&soap, nbfiles * sizeof(struct ns1__TGetFileRequest *))) == NULL || (req.transferParameters = soap_malloc (&soap, sizeof(struct ns1__TTransferParameters))) == NULL) { serrno = ENOMEM; soap_end (&soap); soap_done (&soap); return (-1); } req.arrayOfFileRequests->__sizerequestArray = nbfiles; for (i = 0; i < nbfiles; i++) { if ((req.arrayOfFileRequests->requestArray[i] = soap_malloc (&soap, sizeof(struct ns1__TGetFileRequest))) == NULL) { serrno = ENOMEM; soap_end (&soap); soap_done (&soap); return (-1); } req.arrayOfFileRequests->requestArray[i]->sourceSURL = (char *) surls[i]; req.arrayOfFileRequests->requestArray[i]->dirOption = NULL; } memset (req.transferParameters, 0, sizeof(struct ns1__TTransferParameters)); if ((req.transferParameters->arrayOfTransferProtocols = soap_malloc (&soap, nbprotocols * sizeof(struct ns1__ArrayOfString))) == NULL) { serrno = ENOMEM; soap_end (&soap); soap_done (&soap); return (-1); } req.transferParameters->arrayOfTransferProtocols->__sizestringArray = nbprotocols; req.transferParameters->arrayOfTransferProtocols->stringArray = protocols; if (soap_call_ns1__srmPrepareToGet (&soap, srm_endpoint, "PrepareToGet", &req, &rep)) { serrno = soap_error2serrno (&soap); soap_end (&soap); soap_done (&soap); return (-1); } reqstatp = rep.srmPrepareToGetResponse->returnStatus; if (rep.srmPrepareToGetResponse->requestToken) *r_token = strdup (rep.srmPrepareToGetResponse->requestToken); else *r_token = NULL; repfs = rep.srmPrepareToGetResponse->arrayOfFileStatuses; if (! repfs || repfs->__sizestatusArray <= 0 || ! repfs->statusArray) { *filestatuses = NULL; } else if ((*filestatuses = calloc (repfs->__sizestatusArray, sizeof(struct dpm_getfilestatus)))) { *nbreplies = repfs->__sizestatusArray; for (i = 0; i < *nbreplies; i++) { (*filestatuses+i)->from_surl = strdup (repfs->statusArray[i]->sourceSURL); if (repfs->statusArray[i]->transferURL) (*filestatuses+i)->turl = strdup (repfs->statusArray[i]->transferURL); if (repfs->statusArray[i]->fileSize) (*filestatuses+i)->filesize = *repfs->statusArray[i]->fileSize; (*filestatuses+i)->status = statuscode2dpmstatus (repfs->statusArray[i]->status->statusCode, 1); if (repfs->statusArray[i]->status->explanation) (*filestatuses+i)->errstring = strdup (repfs->statusArray[i]->status->explanation); if (repfs->statusArray[i]->remainingPinTime) (*filestatuses+i)->pintime = *repfs->statusArray[i]->remainingPinTime; } } if (reqstatp->explanation) dpm_errmsg (NULL, "%s\n", reqstatp->explanation); status = statuscode2dpmstatus (reqstatp->statusCode, 0); soap_end (&soap); soap_done (&soap); return (status); } int srmv2_getfilesize(char *surl, u_signed64 *filesize, int timeout) { int nblevel = 0; struct ns1__srmLsResponse_ rep; struct ns1__ArrayOfTMetaDataPathDetail *repfs; struct ns1__srmLsRequest req; struct ns1__TReturnStatus *reqstatp; struct soap soap; char srm_endpoint[256]; if (get_srm_endpoint (surl, srm_endpoint, sizeof(srm_endpoint)) < 0) { dpm_errmsg (NULL, "SRM endpoint too long\n"); return (-1); } srmv2_init (&soap, timeout); memset (&req, 0, sizeof(req)); if ((req.arrayOfSURLs = soap_malloc (&soap, sizeof(struct ns1__ArrayOfAnyURI))) == NULL) { serrno = ENOMEM; soap_end (&soap); soap_done (&soap); return (-1); } req.arrayOfSURLs->__sizeurlArray = 1; req.arrayOfSURLs->urlArray = &surl; req.numOfLevels = &nblevel; if (soap_call_ns1__srmLs (&soap, srm_endpoint, "Ls", &req, &rep)) { serrno = soap_error2serrno (&soap); soap_end (&soap); soap_done (&soap); return (-1); } reqstatp = rep.srmLsResponse->returnStatus; repfs = rep.srmLsResponse->details; if (reqstatp->statusCode != SRM_USCORESUCCESS && reqstatp->statusCode != SRM_USCOREFAILURE) { serrno = statuscode2serrno (reqstatp->statusCode); if (reqstatp->explanation) dpm_errmsg (NULL, "%s\n", reqstatp->explanation); soap_end (&soap); soap_done (&soap); return (-1); } if (! repfs || repfs->__sizepathDetailArray <= 0 || ! repfs->pathDetailArray) { dpm_errmsg (NULL, "srmLs returned empty response\n"); serrno = SEINTERNAL; soap_end (&soap); soap_done (&soap); return (-1); } if (repfs->pathDetailArray[0]->status && repfs->pathDetailArray[0]->status->statusCode != SRM_USCORESUCCESS) { serrno = statuscode2serrno (repfs->pathDetailArray[0]->status->statusCode); if (repfs->pathDetailArray[0]->status->explanation) dpm_errmsg (NULL, "%s\n", repfs->pathDetailArray[0]->status->explanation); soap_end (&soap); soap_done (&soap); return (-1); } if (! repfs->pathDetailArray[0]->size) { dpm_errmsg (NULL, "srmLs returned empty size\n"); serrno = SEINTERNAL; soap_end (&soap); soap_done (&soap); return (-1); } *filesize = *repfs->pathDetailArray[0]->size; soap_end (&soap); soap_done (&soap); return (0); } int srmv2_getstatus_getreq(char *r_token, int nbfiles, char **surls, char *srm_endpoint, int *nbreplies, struct dpm_getfilestatus **filestatuses, int timeout) { int i; struct ns1__srmStatusOfGetRequestResponse_ rep; struct ns1__ArrayOfTGetRequestFileStatus *repfs; struct ns1__srmStatusOfGetRequestRequest req; struct ns1__TReturnStatus *reqstatp; struct soap soap; int status; srmv2_init (&soap, timeout); memset (&req, 0, sizeof(req)); req.requestToken = r_token; if (surls) { if ((req.arrayOfSourceSURLs = soap_malloc (&soap, sizeof(struct ns1__ArrayOfAnyURI))) == NULL || (req.arrayOfSourceSURLs->urlArray = soap_malloc (&soap, nbfiles * sizeof(char *))) == NULL) { serrno = ENOMEM; soap_end (&soap); soap_done (&soap); return (-1); } req.arrayOfSourceSURLs->__sizeurlArray = nbfiles; for (i = 0; i < nbfiles; i++) { req.arrayOfSourceSURLs->urlArray[i] = surls[i]; } } if (soap_call_ns1__srmStatusOfGetRequest (&soap, srm_endpoint, "StatusOfGetRequest", &req, &rep)) { serrno = soap_error2serrno (&soap); soap_end (&soap); soap_done (&soap); return (-1); } reqstatp = rep.srmStatusOfGetRequestResponse->returnStatus; repfs = rep.srmStatusOfGetRequestResponse->arrayOfFileStatuses; if (! repfs || repfs->__sizestatusArray <= 0 || ! repfs->statusArray) { *filestatuses = NULL; } else if ((*filestatuses = calloc (repfs->__sizestatusArray, sizeof(struct dpm_getfilestatus)))) { *nbreplies = repfs->__sizestatusArray; for (i = 0; i < *nbreplies; i++) { (*filestatuses+i)->from_surl = strdup (repfs->statusArray[i]->sourceSURL); if (repfs->statusArray[i]->transferURL) (*filestatuses+i)->turl = strdup (repfs->statusArray[i]->transferURL); if (repfs->statusArray[i]->fileSize) (*filestatuses+i)->filesize = *repfs->statusArray[i]->fileSize; (*filestatuses+i)->status = statuscode2dpmstatus (repfs->statusArray[i]->status->statusCode, 1); if (repfs->statusArray[i]->status->explanation) (*filestatuses+i)->errstring = strdup (repfs->statusArray[i]->status->explanation); if (repfs->statusArray[i]->remainingPinTime) (*filestatuses+i)->pintime = *repfs->statusArray[i]->remainingPinTime; } } if (reqstatp->explanation) dpm_errmsg (NULL, "%s\n", reqstatp->explanation); status = statuscode2dpmstatus (reqstatp->statusCode, 0); soap_end (&soap); soap_done (&soap); return (status); } int srmv2_getstatus_putreq(char *r_token, int nbfiles, char **surls, char *srm_endpoint, int *nbreplies, struct dpm_putfilestatus **filestatuses, int timeout) { time_t current_time; int i; struct ns1__srmStatusOfPutRequestResponse_ rep; struct ns1__ArrayOfTPutRequestFileStatus *repfs; struct ns1__srmStatusOfPutRequestRequest req; struct ns1__TReturnStatus *reqstatp; struct soap soap; int status; srmv2_init (&soap, timeout); memset (&req, 0, sizeof(req)); req.requestToken = r_token; if (surls) { if ((req.arrayOfTargetSURLs = soap_malloc (&soap, sizeof(struct ns1__ArrayOfAnyURI))) == NULL || (req.arrayOfTargetSURLs->urlArray = soap_malloc (&soap, nbfiles * sizeof(char *))) == NULL) { serrno = ENOMEM; soap_end (&soap); soap_done (&soap); return (-1); } req.arrayOfTargetSURLs->__sizeurlArray = nbfiles; for (i = 0; i < nbfiles; i++) { req.arrayOfTargetSURLs->urlArray[i] = surls[i]; } } if (soap_call_ns1__srmStatusOfPutRequest (&soap, srm_endpoint, "StatusOfPutRequest", &req, &rep)) { serrno = soap_error2serrno (&soap); soap_end (&soap); soap_done (&soap); return (-1); } reqstatp = rep.srmStatusOfPutRequestResponse->returnStatus; repfs = rep.srmStatusOfPutRequestResponse->arrayOfFileStatuses; if (! repfs || repfs->__sizestatusArray <= 0 || ! repfs->statusArray) { *filestatuses = NULL; } else if ((*filestatuses = calloc (repfs->__sizestatusArray, sizeof(struct dpm_putfilestatus)))) { *nbreplies = repfs->__sizestatusArray; for (i = 0; i < *nbreplies; i++) { (*filestatuses+i)->to_surl = strdup (repfs->statusArray[i]->SURL); if (repfs->statusArray[i]->transferURL) (*filestatuses+i)->turl = strdup (repfs->statusArray[i]->transferURL); if (repfs->statusArray[i]->fileSize) (*filestatuses+i)->filesize = *repfs->statusArray[i]->fileSize; (*filestatuses+i)->status = statuscode2dpmstatus (repfs->statusArray[i]->status->statusCode, 1); if (repfs->statusArray[i]->status->explanation) (*filestatuses+i)->errstring = strdup (repfs->statusArray[i]->status->explanation); if (repfs->statusArray[i]->remainingPinLifetime) (*filestatuses+i)->pintime = *repfs->statusArray[i]->remainingPinLifetime; if (repfs->statusArray[i]->remainingFileLifetime) { (*filestatuses+i)->f_lifetime = *repfs->statusArray[i]->remainingFileLifetime; if ((*filestatuses+i)->f_lifetime < 0) (*filestatuses+i)->f_lifetime = 0x7FFFFFFF; else if ((*filestatuses+i)->f_lifetime > 0) (*filestatuses+i)->f_lifetime += time (0); } } } if (reqstatp->explanation) dpm_errmsg (NULL, "%s\n", reqstatp->explanation); status = statuscode2dpmstatus (reqstatp->statusCode, 0); soap_end (&soap); soap_done (&soap); return (status); } int srmv2_ping(char *endpoint, int timeout) { struct ns1__srmPingResponse_ rep; struct ns1__srmPingRequest req; struct soap soap; srmv2_init (&soap, timeout); memset (&req, 0, sizeof(req)); if (soap_call_ns1__srmPing (&soap, endpoint, "Ping", &req, &rep)) { serrno = soap_error2serrno (&soap); soap_end (&soap); soap_done (&soap); return (-1); } soap_end (&soap); soap_done (&soap); return (0); } int srmv2_put(int nbfiles, struct dpm_putfilereq *reqfiles, int nbprotocols, char **protocols, int overwrite, int timeout, char **r_token, int *nbreplies, struct dpm_putfilestatus **filestatuses) { int i; struct ns1__srmPrepareToPutResponse_ rep; struct ns1__ArrayOfTPutRequestFileStatus *repfs; struct ns1__srmPrepareToPutRequest req; struct ns1__TReturnStatus *reqstatp; struct soap soap; char srm_endpoint[256]; int status; if (get_srm_endpoint (reqfiles->to_surl, srm_endpoint, sizeof(srm_endpoint)) < 0) { dpm_errmsg (NULL, "SRM endpoint too long\n"); return (-1); } srmv2_init (&soap, timeout); memset (&req, 0, sizeof(req)); if ((req.arrayOfFileRequests = soap_malloc (&soap, sizeof(struct ns1__ArrayOfTPutFileRequest))) == NULL || (req.arrayOfFileRequests->requestArray = soap_malloc (&soap, nbfiles * sizeof(struct ns1__TPutFileRequest *))) == NULL || (req.transferParameters = soap_malloc (&soap, sizeof(struct ns1__TTransferParameters))) == NULL) { serrno = ENOMEM; soap_end (&soap); soap_done (&soap); return (-1); } req.arrayOfFileRequests->__sizerequestArray = nbfiles; for (i = 0; i < nbfiles; i++) { if ((req.arrayOfFileRequests->requestArray[i] = soap_malloc (&soap, sizeof(struct ns1__TPutFileRequest))) == NULL) { serrno = ENOMEM; soap_end (&soap); soap_done (&soap); return (-1); } req.arrayOfFileRequests->requestArray[i]->targetSURL = (reqfiles+i)->to_surl; req.arrayOfFileRequests->requestArray[i]->expectedFileSize = &(reqfiles+i)->requested_size; } if (overwrite) req.overwriteOption = &o_modes[ALWAYS]; if (reqfiles->f_lifetime) { if ((req.desiredFileLifeTime = soap_malloc (&soap, sizeof(int))) == NULL) { serrno = ENOMEM; soap_end (&soap); soap_done (&soap); return (-1); } if (reqfiles->f_lifetime == 0x7FFFFFFF) *req.desiredFileLifeTime = -1; else *req.desiredFileLifeTime = reqfiles->f_lifetime; } if (reqfiles->f_type == 'V') req.desiredFileStorageType = &s_types[VOLATILE]; else if (reqfiles->f_type == 'D') req.desiredFileStorageType = &s_types[DURABLE]; else if (reqfiles->f_type == 'P') req.desiredFileStorageType = &s_types[PERMANENT]; if (*reqfiles->s_token) req.targetSpaceToken = reqfiles->s_token; if (reqfiles->ret_policy != '\0') { if ((req.targetFileRetentionPolicyInfo = soap_malloc (&soap, sizeof(struct ns1__TRetentionPolicyInfo))) == NULL) { serrno = ENOMEM; soap_end (&soap); soap_done (&soap); return (-1); } if (reqfiles->ret_policy == 'R') req.targetFileRetentionPolicyInfo->retentionPolicy = REPLICA; else if (reqfiles->ret_policy == 'O') req.targetFileRetentionPolicyInfo->retentionPolicy = OUTPUT; else req.targetFileRetentionPolicyInfo->retentionPolicy = CUSTODIAL; if (reqfiles->ac_latency == 'O') req.targetFileRetentionPolicyInfo->accessLatency = &al_types[ONLINE]; else if (reqfiles->ac_latency == 'N') req.targetFileRetentionPolicyInfo->accessLatency = &al_types[NEARLINE]; } memset (req.transferParameters, 0, sizeof(struct ns1__TTransferParameters)); if ((req.transferParameters->arrayOfTransferProtocols = soap_malloc (&soap, nbprotocols * sizeof(struct ns1__ArrayOfString))) == NULL) { serrno = ENOMEM; soap_end (&soap); soap_done (&soap); return (-1); } req.transferParameters->arrayOfTransferProtocols->__sizestringArray = nbprotocols; req.transferParameters->arrayOfTransferProtocols->stringArray = protocols; if (soap_call_ns1__srmPrepareToPut (&soap, srm_endpoint, "PrepareToPut", &req, &rep)) { serrno = soap_error2serrno (&soap); soap_end (&soap); soap_done (&soap); return (-1); } reqstatp = rep.srmPrepareToPutResponse->returnStatus; if (rep.srmPrepareToPutResponse->requestToken) *r_token = strdup (rep.srmPrepareToPutResponse->requestToken); else *r_token = NULL; repfs = rep.srmPrepareToPutResponse->arrayOfFileStatuses; if (! repfs || repfs->__sizestatusArray <= 0 || ! repfs->statusArray) { *filestatuses = NULL; } else if ((*filestatuses = calloc (repfs->__sizestatusArray, sizeof(struct dpm_putfilestatus)))) { *nbreplies = repfs->__sizestatusArray; for (i = 0; i < *nbreplies; i++) { (*filestatuses+i)->to_surl = strdup (repfs->statusArray[i]->SURL); if (repfs->statusArray[i]->transferURL) (*filestatuses+i)->turl = strdup (repfs->statusArray[i]->transferURL); if (repfs->statusArray[i]->fileSize) (*filestatuses+i)->filesize = *repfs->statusArray[i]->fileSize; (*filestatuses+i)->status = statuscode2dpmstatus (repfs->statusArray[i]->status->statusCode, 1); if (repfs->statusArray[i]->status->explanation) (*filestatuses+i)->errstring = strdup (repfs->statusArray[i]->status->explanation); if (repfs->statusArray[i]->remainingPinLifetime) (*filestatuses+i)->pintime = *repfs->statusArray[i]->remainingPinLifetime; if (repfs->statusArray[i]->remainingFileLifetime) (*filestatuses+i)->f_lifetime = *repfs->statusArray[i]->remainingFileLifetime; } } if (reqstatp->explanation) dpm_errmsg (NULL, "%s\n", reqstatp->explanation); status = statuscode2dpmstatus (reqstatp->statusCode, 0); soap_end (&soap); soap_done (&soap); return (status); } int srmv2_putdone(char *r_token, int nbsurls, char **surls, int *nbreplies, struct dpm_filestatus **filestatuses, int timeout) { int i; struct ns1__srmPutDoneResponse_ rep; struct ns1__ArrayOfTSURLReturnStatus *repfs; struct ns1__srmPutDoneRequest req; struct ns1__TReturnStatus *reqstatp; struct soap soap; char srm_endpoint[256]; int status; if (get_srm_endpoint (surls[0], srm_endpoint, sizeof(srm_endpoint)) < 0) { dpm_errmsg (NULL, "SRM endpoint too long\n"); return (-1); } srmv2_init (&soap, timeout); memset (&req, 0, sizeof(req)); req.requestToken = r_token; if ((req.arrayOfSURLs = soap_malloc (&soap, sizeof(struct ns1__ArrayOfAnyURI))) == NULL || (req.arrayOfSURLs->urlArray = soap_malloc (&soap, nbsurls * sizeof(char *))) == NULL) { serrno = ENOMEM; soap_end (&soap); soap_done (&soap); return (-1); } req.arrayOfSURLs->__sizeurlArray = nbsurls; for (i = 0; i < nbsurls; i++) { req.arrayOfSURLs->urlArray[i] = surls[i]; } if (soap_call_ns1__srmPutDone (&soap, srm_endpoint, "PutDone", &req, &rep)) { serrno = soap_error2serrno (&soap); soap_end (&soap); soap_done (&soap); return (-1); } reqstatp = rep.srmPutDoneResponse->returnStatus; repfs = rep.srmPutDoneResponse->arrayOfFileStatuses; if (! repfs || repfs->__sizestatusArray <= 0 || ! repfs->statusArray) { *filestatuses = NULL; } else if ((*filestatuses = malloc (repfs->__sizestatusArray * sizeof(struct dpm_filestatus)))) { *nbreplies = repfs->__sizestatusArray; for (i = 0; i < *nbreplies; i++) { (*filestatuses+i)->surl = strdup (repfs->statusArray[i]->surl); (*filestatuses+i)->status = statuscode2dpmstatus (repfs->statusArray[i]->status->statusCode, 1); if (repfs->statusArray[i]->status->explanation) (*filestatuses+i)->errstring = strdup (repfs->statusArray[i]->status->explanation); else (*filestatuses+i)->errstring = NULL; } } if (reqstatp->explanation) dpm_errmsg (NULL, "%s\n", reqstatp->explanation); status = statuscode2dpmstatus (reqstatp->statusCode, 0); soap_end (&soap); soap_done (&soap); return (status); } int srmv2_relfiles(char *r_token, int nbsurls, char **surls, int *nbreplies, struct dpm_filestatus **filestatuses, int timeout) { int i; struct ns1__srmReleaseFilesResponse_ rep; struct ns1__ArrayOfTSURLReturnStatus *repfs; struct ns1__srmReleaseFilesRequest req; struct ns1__TReturnStatus *reqstatp; struct soap soap; char srm_endpoint[256]; int status; if (get_srm_endpoint (surls[0], srm_endpoint, sizeof(srm_endpoint)) < 0) { dpm_errmsg (NULL, "SRM endpoint too long\n"); return (-1); } srmv2_init (&soap, timeout); memset (&req, 0, sizeof(req)); req.requestToken = r_token; if ((req.arrayOfSURLs = soap_malloc (&soap, sizeof(struct ns1__ArrayOfAnyURI))) == NULL || (req.arrayOfSURLs->urlArray = soap_malloc (&soap, nbsurls * sizeof(char *))) == NULL) { serrno = ENOMEM; soap_end (&soap); soap_done (&soap); return (-1); } req.arrayOfSURLs->__sizeurlArray = nbsurls; for (i = 0; i < nbsurls; i++) { req.arrayOfSURLs->urlArray[i] = surls[i]; } if (soap_call_ns1__srmReleaseFiles (&soap, srm_endpoint, "ReleaseFiles", &req, &rep)) { serrno = soap_error2serrno (&soap); soap_end (&soap); soap_done (&soap); return (-1); } reqstatp = rep.srmReleaseFilesResponse->returnStatus; repfs = rep.srmReleaseFilesResponse->arrayOfFileStatuses; if (! repfs || repfs->__sizestatusArray <= 0 || ! repfs->statusArray) { *filestatuses = NULL; } else if ((*filestatuses = malloc (repfs->__sizestatusArray * sizeof(struct dpm_filestatus)))) { *nbreplies = repfs->__sizestatusArray; for (i = 0; i < *nbreplies; i++) { (*filestatuses+i)->surl = strdup (repfs->statusArray[i]->surl); (*filestatuses+i)->status = statuscode2dpmstatus (repfs->statusArray[i]->status->statusCode, 1); if (repfs->statusArray[i]->status->explanation) (*filestatuses+i)->errstring = strdup (repfs->statusArray[i]->status->explanation); else (*filestatuses+i)->errstring = NULL; } } if (reqstatp->explanation) dpm_errmsg (NULL, "%s\n", reqstatp->explanation); status = statuscode2dpmstatus (reqstatp->statusCode, 0); soap_end (&soap); soap_done (&soap); return (status); } lcgdm-1.10.0/dpmcopy/dpmcopyd.man0000644000175000017500000001072511763665646016237 0ustar ellertellert.\" @(#)$RCSfile: dpmcopyd.man,v $ $Revision: 6384 $ $Date: 2012-06-06 16:39:34 +0200 (Wed, 06 Jun 2012) $ CERN IT-GD/ITR Jean-Philippe Baud .\" Copyright (C) 2007-2011 by CERN/IT/GD/ITR .\" All rights reserved .\" .TH DPMCOPYD 8 "$Date: 2012-06-06 16:39:34 +0200 (Wed, 06 Jun 2012) $" LCG "DPM Administrator Commands" .SH NAME dpmcopyd \- start the Disk Pool Manager Copy backend .SH SYNOPSIS .B dpmcopyd [ .BI -c " config_file" ] [ .BI -l " log_file" ] [ .BI -4 | .BI -6 ] .SH DESCRIPTION .LP The .B dpmcopyd command starts the Disk Pool Manager Copy backend. This command is usually executed at system startup time .RB ( /etc/rc.local ). This will read the Disk Pool Manager "request" database configuration file and look for requests. Each of them is processed in a child process which opens a connection to the database server if necessary. .LP All error messages and statistical information are kept in a log. .LP The maximum number of child processes is set by default to 20. If there are more concurrent requests, they remain in the queue until a worker process is available. The maximum number of child processes can be changed by putting an entry in .B /etc/shift.conf for example: .RS .HP DPMCOPYD MAX_WORKERS 30 .RE .LP The Disk Pool Manager Copy backend listen port number can be defined on client hosts and on the server itself in either of the following ways: .RS .LP setting an environment variable DPMCOPYD_PORT .RS .HP setenv DPMCOPYD_PORT 5017 .RE .LP an entry in .B /etc/shift.conf like: .RS .HP DPMCOPYD PORT 5017 .RE .RE .LP If none of these methods is used, the default port number is taken from the definition of DPMCOPYD_PORT in dpmcopy_constants.h. .LP The Disk Pool Manager Copy backend host name can be defined on client hosts in either of the following ways: .RS .LP setting an environment variable DPMCOPYD_HOST, for example: .RS .HP setenv DPMCOPYD_HOST sehost .RE .LP an entry in .B /etc/shift.conf for example: .RS .HP DPMCOPYD HOST sehost .RE .RE .LP If none of these methods is used, the default host is taken from the definition of DpmHost in site.def. .LP The Disk Pool Manager Copy backend "request" database keeps the requests and their status even after completion. .LP The Disk Pool Manager configuration file contains password information for the database and must be readable/writable only by root. It contains a single line in the format: .HP .RS username/password@server .RE or .RS username/password@server/dbname .RE .sp where 'username' and 'password' are the credentials to login to the database instance identified by 'server'. If 'dbname' is not specified, "dpm_db" is used. .LP In the log each entry has a timestamp. All entries corresponding to one request have the same process id. For each user command there is one message giving information about the requestor DN and several lines when getting the TURLs for the source/destination files and when doing the copy itself. The completion code of the command is also logged. .SH OPTIONS .TP .BI -c " config_file" Specifies a different path for the Disk Pool Manager configuration file. .TP .BI -l " log_file" Specifies a different path for the Disk Pool Manager log file. The special value .B syslog will send the log messages to the system logger syslogd. .TP .BI -4 only try to listen on IPv4 addresses .TP .BI -6 only try to listen on IPv6 addresses .SH FILES .TP 1.8i .B /etc/DPMCONFIG configuration file .TP .B /var/log/dpmcopy/log .SH EXAMPLES .TP Here is a small log: .nf 03/27 09:34:30 29631 dpmcopyd: started 03/27 17:04:36 21024 dpmcopyd: inc_reqctr request from lxb6133v1.cern.ch 03/27 17:04:36 21024 dpmcopyd: decrementing reqctr 03/27 17:04:36 21129 dpmcopyd: processing request d3cc74d5-f9c0-4e21-83d2-a29fd8e692af from /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=baud/CN=373165/CN=Jean-Philippe Baud 03/27 17:04:36 21129 dpmcopy_push: calling dpm_get 03/27 17:04:36 21129 dpmcopy_push: dpm_get returned request token 25bd8353-6ee1-4d60-b7cb-a5120dfa1069 03/27 17:04:37 21129 dpmcopy_push: calling srmv2_put 03/27 17:04:37 21129 dpmcopy_push: srmv2_put returned request token 85872006-11d6-404b-8ebe-0b9fd85031b8 03/27 17:04:42 21129 dpmcopy_push: copying gsiftp://lxb6133v1.cern.ch/lxb6133v1.cern.ch:/dpm_data/dteam/2008-03-27/jpbt1.1.0 to gsiftp://lxdpm102.cern.ch/lxdpm102.cern.ch:/data01/dteam/2008-03-27/jpbt9.478949.0 03/27 17:04:43 21129 dpmcopy_push: dpm_copyfile returned 0, serrno = 0 03/27 17:04:43 21129 dpmcopy_push: calling srmv2_putdone 03/27 17:04:44 21024 dpmcopyd: process 21129 exiting with status 0 .fi .SH SEE ALSO .B Clogit(3) lcgdm-1.10.0/dpmcopy/dpmcopy_inc_reqctr.c0000644000175000017500000000264011066421615017726 0ustar ellertellert/* * Copyright (C) 2007 by CERN/IT/GD/ITR * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: dpmcopy_inc_reqctr.c,v $ $Revision: 1.1 $ $Date: 2008/09/24 11:25:00 $ CERN IT-GD/ITR Jean-Philippe Baud"; #endif /* not lint */ /* dpmcopy_inc_reqctr - increment dpmcopyd request counter */ #include #include #include #include #if defined(_WIN32) #include #else #include #include #endif #include "dpmcopy_api.h" #include "dpm.h" #include "marshall.h" #include "serrno.h" int DLL_DECL dpmcopy_inc_reqctr () { int c; char func[19]; gid_t gid; int msglen; char *q; char *sbp; char sendbuf[REQBUFSZ]; uid_t uid; strcpy (func, "dpmcopy_inc_reqctr"); uid = geteuid(); gid = getegid(); #if defined(_WIN32) if (uid < 0 || gid < 0) { dpm_errmsg (func, DP053); serrno = SENOMAPFND; return (-1); } #endif /* Build request header */ sbp = sendbuf; marshall_LONG (sbp, DPM_MAGIC); marshall_LONG (sbp, DPM_INCREQCTR); q = sbp; /* save pointer. The next field will be updated */ msglen = 3 * LONGSIZE; marshall_LONG (sbp, msglen); /* Build request body */ marshall_LONG (sbp, uid); marshall_LONG (sbp, gid); msglen = sbp - sendbuf; marshall_LONG (q, msglen); /* update length field */ while ((c = send2dpmcopyd (NULL, sendbuf, msglen, NULL, 0)) && serrno == EDPMNACT) sleep (RETRYI); return (c); } lcgdm-1.10.0/dpmcopy/srm.v2.2.wsdl0000644000175000017500000030631711066421615016070 0ustar ellertellert srm.v2.2.wsdl Wed Sep 27 08:22:41 PDT 2006 Mon Jul 3 09:49:53 PDT 2006 Tue Jun 20 07:21:54 PDT 2006 - FINALIZED Mon Jun 19 09:45:38 PDT 2006 Created by Junmin Gu, Alex Sim Lawrence Berkeley National Laboratory on basis of the Storage Resource Manager Interface Specification v2.2 published at http://sdm.lbl.gov/srm-wg the following location of the service is specific to the particular deployment and is not part of the specification lcgdm-1.10.0/dpmcopy/send2dpmcopyd.c0000644000175000017500000001310012245612447016613 0ustar ellertellert/* * Copyright (C) 2007-2008 by CERN/IT/GD/ITR * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: send2dpmcopyd.c,v $ $Revision: 1.4 $ $Date: 2009/01/11 00:43:26 $ CERN IT-GD/ITR Jean-Philippe Baud"; #endif /* not lint */ #include #include #include #include #include #if defined(_WIN32) #include #else #include #include #include #include #endif #include "Cnetdb.h" #ifdef CSEC #include "Csec_api.h" #endif #include "dpmcopy_api.h" #include "dpm.h" #include "dpm_api.h" #include "marshall.h" #include "net.h" #include "serrno.h" #if defined(_WIN32) extern char *ws_strerr; #endif /* send2dpmcopyd - send a request to the DPM COPY backend and wait for the reply */ send2dpmcopyd(host, reqp, reql, user_repbuf, user_repbuf_len) char *host; char *reqp; int reql; char *user_repbuf; int user_repbuf_len; { int actual_replen = 0; struct addrinfo *ai; struct addrinfo *aitop; int c; #ifdef CSEC Csec_context_t ctx; #endif char dpmcopydhost[CA_MAXHOSTNAMELEN+1]; char func[16]; int gaierrno; char *getconfent(); char *getenv(); struct addrinfo hints; int isconnected; int magic; int n; char *neterrstr = NULL; char *p; char prtbuf[PRTBUFSZ]; int rep_type; char repbuf[REPBUFSZ]; int s; int save_serrno; char strport[NI_MAXSERV]; strcpy (func, "send2dpmcopyd"); if ((p = getenv ("DPMCOPYD_PORT")) || (p = getconfent ("DPMCOPYD", "PORT", 0))) { strncpy (strport, p, sizeof(strport)); strport[sizeof(strport)-1] = '\0'; } else { snprintf (strport, sizeof(strport), "%u", DPMCOPYD_PORT); serrno = 0; } if (host && *host) strcpy (dpmcopydhost, host); else if ((p = getenv ("DPMCOPYD_HOST")) || (p = getconfent ("DPMCOPYD", "HOST", 0))) strcpy (dpmcopydhost, p); else { #if defined(DPM_HOST) strcpy (dpmcopydhost, DPM_HOST); #else gethostname (dpmcopydhost, sizeof(dpmcopydhost)); #endif serrno = 0; } memset (&hints, 0, sizeof(struct addrinfo)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; #ifdef AI_ADDRCONFIG hints.ai_flags |= AI_ADDRCONFIG; #endif gaierrno = Cgetaddrinfo (dpmcopydhost, strport, &hints, &aitop); if (gaierrno !=0 && serrno == 0) serrno = SENOSHOST; if (gaierrno == EAI_NONAME) { dpm_errmsg (func, DP009, "Host unknown:", dpmcopydhost); return (-1); } else if (gaierrno != 0) { dpm_errmsg (func, "Error during lookup of %s: %s\n", dpmcopydhost, Cgai_strerror (gaierrno)); return (-1); } isconnected = 0; save_serrno = 0; for (ai = aitop; ai && !isconnected; ai = ai->ai_next) { if (ai->ai_family != PF_INET && ai->ai_family != PF_INET6) continue; if ((s = socket (ai->ai_family, ai->ai_socktype, ai->ai_protocol))<0) continue; if (connect (s, ai->ai_addr, ai->ai_addrlen) < 0) { #if defined(_WIN32) if (WSAGetLastError() == WSAEAFNOSUPPORT) { #else if (errno == EAFNOSUPPORT) { #endif (void) netclose (s); continue; } #if defined(_WIN32) if (WSAGetLastError() == WSAECONNREFUSED) { #else if (errno == ECONNREFUSED) { #endif save_serrno = EDPMNACT; } else { save_serrno = SECOMERR; } p = neterror (); if (neterrstr) free (neterrstr); neterrstr = strdup (p); (void) netclose (s); } else { isconnected = 1; } } freeaddrinfo (aitop); if (!isconnected) { serrno = (save_serrno) ? save_serrno : SECOMERR; switch(serrno) { case EDPMNACT: dpm_errmsg (func, DP000, dpmcopydhost); break; default: if (neterrstr) { dpm_errmsg (func, DP002, "connect", neterrstr); } else { dpm_errmsg (func, "Could not create " "an outgoing connection\n"); } break; } if (neterrstr) free (neterrstr); return (-1); } if (neterrstr) { free (neterrstr); neterrstr = NULL; } #ifdef CSEC Csec_client_initContext (&ctx, CSEC_SERVICE_TYPE_HOST, NULL); if (Csec_client_establishContext (&ctx, s) < 0) { if (serrno != SECOMERR && serrno != SETIMEDOUT) dpm_errmsg (func, DP002, "send", Csec_getErrorMessageSummary (PRTBUFSZ-48)); (void) netclose (s); Csec_clearContext (&ctx); return (-1); } Csec_clearContext (&ctx); #endif /* send request to DPM COPY server */ if ((n = netwrite (s, reqp, reql)) <= 0) { if (n == 0) dpm_errmsg (func, DP002, "send", sys_serrlist[SERRNO]); else dpm_errmsg (func, DP002, "send", neterror()); (void) netclose (s); serrno = SECOMERR; return (-1); } /* get reply */ while (1) { if ((n = netread (s, repbuf, 3 * LONGSIZE)) <= 0) { if (n == 0) dpm_errmsg (func, DP002, "recv", sys_serrlist[SERRNO]); else dpm_errmsg (func, DP002, "recv", neterror()); (void) netclose (s); serrno = SECOMERR; return (-1); } p = repbuf; unmarshall_LONG (p, magic) ; unmarshall_LONG (p, rep_type) ; unmarshall_LONG (p, c) ; if (rep_type == DPM_RC) { (void) netclose (s); if (c) { serrno = c; c = -1; } break; } if (c > REPBUFSZ) { dpm_errmsg (func, "reply too large\n"); serrno = SEINTERNAL; return (-1); } if ((n = netread (s, repbuf, c)) <= 0) { if (n == 0) dpm_errmsg (func, DP002, "recv", sys_serrlist[SERRNO]); else dpm_errmsg (func, DP002, "recv", neterror()); (void) netclose (s); serrno = SECOMERR; return (-1); } p = repbuf; if (rep_type == MSG_ERR) { unmarshall_STRING (p, prtbuf); dpm_errmsg (NULL, "%s", prtbuf); } else if (user_repbuf) { if (actual_replen + c <= user_repbuf_len) n = c; else n = user_repbuf_len - actual_replen; if (n) { memcpy (user_repbuf + actual_replen, repbuf, n); actual_replen += n; } } } return (c); } lcgdm-1.10.0/dpmcopy/dpmcopyd.scripts.oracle0000644000175000017500000002177011763665646020421 0ustar ellertellert#!/bin/sh # # dpmcopyd Start/Stop dpmcopyd # # chkconfig: - 93 17 # description: DPM COPY server daemon # # $Id: dpmcopyd.scripts.oracle 6384 2012-06-06 14:39:34Z rocha $ # # @(#)$RCSfile: dpmcopyd.scripts.oracle,v $ $Revision: 6384 $ $Date: 2012-06-06 16:39:34 +0200 (Wed, 06 Jun 2012) $ CERN/IT/ADC/CA Jean-Damien Durand # # ## PLEASE USE sysconfig FILE TO CHANGE THESE ENVIRONMENT VARIABLES # PREFIX=/opt/lcg ORACLE_HOME=/usr/lib/oracle/10.2.0.1/client export ORACLE_HOME GRIDMAPDIR=/etc/grid-security/gridmapdir export GRIDMAPDIR GRIDMAP=/etc/grid-security/grid-mapfile export GRIDMAP CSEC_MECH=ID export CSEC_MECH DPMCOPYDLOGFILE=/var/log/dpmcopy/log DPMCONFIGFILE=/opt/lcg/etc/DPMCONFIG DPMUSER=dpmmgr DPMGROUP=dpmmgr sysname=`uname -s` # source function library if [ -r /etc/rc.d/init.d/functions ]; then . /etc/rc.d/init.d/functions DAEMON="daemon --check dpmcopyd" FAILURE=failure ECHO_FAILURE=echo_failure SUCCESS=success ECHO_SUCCESS=echo_success ECHO_END=echo if [ $sysname = "Linux" ]; then ECHOOPT=-n fi else DAEMON=eval FAILURE= ECHO_FAILURE= SUCCESS= ECHO_SUCCESS= ECHOOPT= ECHO_END= fi RETVAL=0 prog="dpmcopyd" PIDFILE=/var/run/dpmcopyd.pid PIDDIR=/var/run SUBSYS=/var/lock/subsys/dpmcopyd SUBSYSDIR=/var/lock/subsys [ -z "$SILENTSTOP" ] && SILENTSTOP=0 DPMCOPYD=$PREFIX/sbin/dpmcopyd DPMCOPYSHUTDOWN=$PREFIX/sbin/dpmcopy-shutdown if [ -r $PREFIX/etc/dpmcopyd.conf ]; then SYSCONFIGDPMCOPYD=$PREFIX/etc/dpmcopyd.conf elif [ -r /etc/sysconfig/dpmcopyd ]; then SYSCONFIGDPMCOPYD=/etc/sysconfig/dpmcopyd elif [ -r /etc/default/dpmcopyd ]; then SYSCONFIGDPMCOPYD=/etc/default/dpmcopyd fi # ## Blindly attempt to create useful directories # # [ ! -d $PIDDIR ] && mkdir -p $PIDDIR > /dev/null 2>&1 # [ ! -d $SUBSYSDIR ] && mkdir -p $SUBSYSDIR > /dev/null 2>&1 if [ $sysname = "HP-UX" ]; then export UNIX95=1 fi if [ $sysname = "SunOS" ]; then format4comm="fname" elif [ $sysname = "Darwin" ]; then format4comm="ucomm" else format4comm="comm" fi case "$1" in start) DPMUSERHOME=`finger $DPMUSER | grep -i directory: | cut -f 2 -d' '` TNS_ADMIN=$DPMUSERHOME/.tnsadmin export TNS_ADMIN X509_USER_CERT=/etc/grid-security/$DPMUSER/dpmcert.pem export X509_USER_CERT X509_USER_KEY=/etc/grid-security/$DPMUSER/dpmkey.pem export X509_USER_KEY netstat -an | egrep '[:.]5017' | egrep 'LISTEN *$' > /dev/null if [ $? -eq 0 ]; then echo $ECHOOPT "dpmcopyd already started: " [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "dpmcopyd already started: " RETVAL=0 else if [ -n "$SYSCONFIGDPMCOPYD" ]; then # ## Source the configuration # . $SYSCONFIGDPMCOPYD if [ "${RUN_DPMCOPYDAEMON}" != "yes" ]; then echo $ECHOOPT "$SYSCONFIGDPMCOPYD says NO: " [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "$SYSCONFIGDPMCOPYD says NO: " RETVAL=0 $ECHO_END exit $RETVAL fi export DPM_HOST export DPNS_HOST if [ -n "${ULIMIT_N}" ]; then ulimit -n ${ULIMIT_N} fi fi if [ ! -s "$DPMCONFIGFILE" ]; then echo $ECHOOPT "config file $DPMCONFIGFILE empty: " [ -n "$ECHO_FAILURE" ] && $ECHO_FAILURE "config file $DPMCONFIGFILE empty: " RETVAL=1 fi if [ ! -d $ORACLE_HOME ]; then echo $ECHOOPT "No Oracle Client found: " [ -n "$ECHO_FAILURE" ] && $ECHO_FAILURE "No Oracle Client found: " RETVAL=1 fi # get TWO_TASK or ORACLE_SID if [ "${DB_IS_LOCAL}" != "yes" ]; then TWO_TASK=`head -1 $DPMCONFIGFILE | cut -f2 -d@` export TWO_TASK else ORACLE_SID=`head -1 $DPMCONFIGFILE | cut -f2 -d@` export ORACLE_SID fi LD_LIBRARY_PATH=$ORACLE_HOME/lib:/opt/glite/lib:/opt/globus/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH ORACLECLIENT=`ldconfig -p | grep libclntsh` if [ "x${ORACLECLIENT}" == "x" ]; then echo $ECHOOPT "No Oracle Client installed: " [ -n "$ECHO_FAILURE" ] && $ECHO_FAILURE "No Oracle Client installed: " RETVAL=1 fi if [ $RETVAL -eq 0 ]; then echo $ECHOOPT "Starting $prog: " cd / mkdir -p `dirname $DPMCOPYDLOGFILE` chown $DPMUSER:$DPMGROUP `dirname $DPMCOPYDLOGFILE` if [ "${ALLOW_COREDUMP}" != "yes" ]; then $DAEMON "su $DPMUSER -c \"LD_LIBRARY_PATH=$LD_LIBRARY_PATH $DPMCOPYD -c $DPMCONFIGFILE -l $DPMCOPYDLOGFILE\"" else $DAEMON "su $DPMUSER -c \"mkdir -p $DPMUSERHOME/dpmcopy; cd $DPMUSERHOME/dpmcopy; hostname -f >> logstart; date >> logstart; umask 0; umask >> logstart; ulimit -c unlimited; pwd >> logstart; ulimit -c >> logstart; echo DAEMON $DPMCOPYD \`hostname -f\` >> logstart; LD_LIBRARY_PATH=$LD_LIBRARY_PATH $DPMCOPYD -c $DPMCONFIGFILE -l $DPMCOPYDLOGFILE\"" fi if [ $? -eq 0 ]; then [ -d $SUBSYSDIR ] && touch $SUBSYS if [ -d $PIDDIR ]; then pid=`ps -eo pid,ppid,$format4comm | grep " 1 dpmcopyd$" | awk '{print $1}'` # The point of $PIDFILE is that it kills only # the master daemon. rm -f $PIDFILE echo $pid > $PIDFILE fi [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "Starting $prog: " RETVAL=0 else [ -n "$ECHO_FAILURE" ] && $ECHO_FAILURE "Starting $prog: " RETVAL=1 fi fi fi $ECHO_END ;; stop) if [ -f $PIDFILE ]; then echo $ECHOOPT "Stopping $prog: " if [ -x $DPMCOPYSHUTDOWN ]; then $DPMCOPYSHUTDOWN -f -h `hostname` > /dev/null 2>&1 RETVAL=$? if [ $RETVAL -ne 0 ]; then kill -2 -`cat $PIDFILE` > /dev/null 2>&1 RETVAL=$? fi else kill -2 -`cat $PIDFILE` > /dev/null 2>&1 RETVAL=$? fi if [ $RETVAL -eq 0 ]; then rm -f $PIDFILE [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "Stopping $prog: " else [ -n "$ECHO_FAILURE" ] && $ECHO_FAILURE "Stopping $prog: " fi else # dpmcopyd might have been started by hand pid=`ps -eo pid,ppid,$format4comm | grep " 1 dpmcopyd$" | awk '{print $1}'` if [ -n "$pid" ]; then echo $ECHOOPT "Stopping $prog: " if [ -x $DPMCOPYSHUTDOWN ]; then $DPMCOPYSHUTDOWN -f -h `hostname` > /dev/null 2>&1 RETVAL=$? if [ $RETVAL -ne 0 ]; then kill -2 -$pid > /dev/null 2>&1 RETVAL=$? fi else kill -2 -$pid > /dev/null 2>&1 RETVAL=$? fi if [ $RETVAL -eq 0 ]; then [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "Stopping $prog: " else [ -n "$ECHO_FAILURE" ] && $ECHO_FAILURE "Stopping $prog: " fi else echo $ECHOOPT "dpmcopyd already stopped: " [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "dpmcopyd already stopped: " [ $SILENTSTOP -eq 0 ] && RETVAL=0 || RETVAL=1 fi fi lpid="X" while [ "x$lpid" != "x" ]; do sleep 1 #Does not seem to work on SunOS ;-) lpid=`ps -eo pid,ppid,$format4comm | grep " 1 dpmcopyd$" | awk '{print $1}'` done [ -d $SUBSYSDIR ] && rm -f $SUBSYS $ECHO_END ;; restart | force-reload) $0 stop if [ $? -eq 0 -o $SILENTSTOP -eq 0 ]; then sleep 1 $0 start RETVAL=$? else RETVAL=0 fi ;; condrestart | try-restart) SILENTSTOP=1 export SILENTSTOP $0 restart RETVAL=$? ;; reload) ;; status) pid=`ps -eo pid,ppid,$format4comm | grep " 1 dpmcopyd$" | awk '{print $1}'` if [ -n "$pid" ]; then echo $ECHOOPT "dpmcopyd (pid $pid) is running..." $ECHO_SUCCESS $ECHO_END RETVAL=0 else if [ -f $PIDFILE ]; then pid=`head -1 $PIDFILE` if [ "$pid" != "" ] ; then echo $ECHOOPT "dpmcopyd dead but pid file exists" $ECHO_FAILURE $ECHO_END RETVAL=1 else echo $ECHOOPT "dpmcopyd dead" $ECHO_FAILURE $ECHO_END RETVAL=1 fi else if [ -f $SUBSYS ]; then echo $ECHOOPT "dpmcopyd dead but subsys ($SUBSYS) locked" RETVAL=2 else echo $ECHOOPT "dpmcopyd is stopped" RETVAL=3 fi $ECHO_FAILURE $ECHO_END fi fi ;; *) echo "Usage: $0 {start|stop|status|restart|condrestart}" RETVAL=1 ;; esac exit $RETVAL lcgdm-1.10.0/dpmcopy/dpmcopy_main.c0000644000175000017500000004444511577650656016552 0ustar ellertellert/* * Copyright (C) 2007-2011 by CERN/IT/GD/ITR * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: dpmcopy_main.c,v $ $Revision: 4496 $ $Date: 2011-06-20 15:57:02 +0200 (Mon, 20 Jun 2011) $ CERN IT-GD/ITR Jean-Philippe Baud"; #endif /* not lint */ #include #include #include #include #include #include #include #if defined(_WIN32) #include #else #include #include #include #include #include #include #endif #include "Cnetdb.h" #include "Cinit.h" #include "Clogit.h" #include "dpm.h" #include "dpm_api.h" #include "dpm_backend.h" #include "dpm_server.h" #include "dpm_util.h" #include "dpmcopy_constants.h" #include "dpmcopy_server.h" #include "dpns_api.h" #include "marshall.h" #include "net.h" #include "patchlevel.h" #include "serrno.h" #define DEFPOLLINT 5 /* * Maximum number of sockets on which the server can listen */ #define MAX_LISTEN_SOCKS 16 char func[16]; char localdomain[CA_MAXHOSTNAMELEN+1]; char localhost[CA_MAXHOSTNAMELEN+1]; int maxfds; int nb_file_err; int nbchildren; int reqctr; int listen_ipv4only=0, listen_ipv6only=0; static int na_key = -1; extern gid_t *Cdecode_groups (char *, int *); extern int Cdomainname (char *, int); extern int isTrustedHost (int, char *, char *, char *, char *); extern char *optarg; extern int optind; void check_child_exit(); void wait4child(); #ifdef CSEC #include Csec_context_t sec_ctx; char *Csec_mech; char *Csec_auth_id; #endif dpmcopy_main(main_args) struct main_args *main_args; { struct addrinfo *ai; struct addrinfo *aitop; int bol; int c; time_t curtime; struct dpm_dbfd dbfd; DBLISTPTR dblistptr; void doit (int); struct dpm_req dpm_req; char *dpmconfigfile = NULL; struct sockaddr_storage from; int fromlen; int gaierrno; char *getconfent(); struct addrinfo hints; int i; time_t lastcheckconfig = 0; time_t lastdbpoll = 0; int listen_socks[MAX_LISTEN_SOCKS]; char logfile[CA_MAXPATHLEN+1]; int maxchildren = DPM_MAXWORKERS; int nfds; int num_listen_socks; int on = 1; /* for REUSEADDR and IPV6_V6ONLY */ char *p; int pid; void procreq(); fd_set readfd, readmask; int rqfd; int s; char strport[NI_MAXSERV]; struct timeval timeval; strcpy (func, "dpmcopyd"); strcpy (logfile, LOGFILE); Cinitlog ("dpmcopyd", LOGFILE); /* process command line options if any */ while ((c = getopt (main_args->argc, main_args->argv, "46c:l:")) != EOF) { switch (c) { case '4': listen_ipv4only++; break; case '6': listen_ipv6only++; break; case 'c': dpmconfigfile = optarg; break; case 'l': if (Cinitlog ("dpmcopyd", optarg) < 0) { dpmlogit (func, "Invalid logfile: %s\n", optarg); exit (USERR); } strcpy (logfile, optarg); break; } } if (listen_ipv4only && listen_ipv6only) { dpmlogit (func, "Can not choose to listen for only IPv4 and " "also only for IPv6\n"); return (USERR); } dpmlogit (func, "started (DPMCOPYD %s-%d)\n", BASEVERSION, PATCHLEVEL); gethostname (localhost, CA_MAXHOSTNAMELEN+1); if (Cdomainname (localdomain, sizeof(localdomain)) < 0) { dpmlogit (func, "Unable to get local domain name\n"); return (SYERR); } if (strchr (localhost, '.') == NULL) { strcat (localhost, "."); strcat (localhost, localdomain); } /* get DB login info from the Disk Pool Manager server config file */ if (dpm_get_dbconf (dpmconfigfile) < 0) return (CONFERR); /* connect to the database */ memset (&dbfd, 0, sizeof(dbfd)); if (dpm_opendb (&dbfd) < 0) return (SYERR); FD_ZERO (&readmask); FD_ZERO (&readfd); #if ! defined(_WIN32) signal (SIGINT, SIG_DFL); signal (SIGPIPE, SIG_IGN); signal (SIGXFSZ, SIG_IGN); #endif /* open request socket */ serrno = 0; memset (&hints, 0, sizeof(struct addrinfo)); if (listen_ipv4only) hints.ai_family = PF_INET; else if (listen_ipv6only) hints.ai_family = PF_INET6; else hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; if ((p = getenv ("DPMCOPYD_PORT")) || (p = getconfent ("DPMCOPYD", "PORT", 0))) { strncpy (strport, p, sizeof(strport)); strport[sizeof(strport)-1] = '\0'; } else { snprintf (strport, sizeof(strport), "%u", DPMCOPYD_PORT); } if (gaierrno=Cgetaddrinfo (NULL, strport, &hints, &aitop)) { dpmlogit (func, DP002, "Cgetaddrinfo", (gaierrno != EAI_SYSTEM) ? Cgai_strerror(gaierrno) : neterror()); return (CONFERR); } num_listen_socks = 0; for (ai = aitop; ai; ai = ai->ai_next) { int fo = 0; if (ai->ai_family != PF_INET && ai->ai_family != PF_INET6) continue; if (num_listen_socks >= MAX_LISTEN_SOCKS) { dpmlogit (func, "Too many listen sockets\n"); freeaddrinfo (aitop); return (CONFERR); } if ((s = socket (ai->ai_family, ai->ai_socktype, ai->ai_protocol))<0) continue; if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on))) { dpmlogit (func, DP002, "setsockopt (SO_REUSEADDR)", neterror()); close (s); continue; } if (ai->ai_family == PF_INET6) { #ifdef IPV6_V6ONLY if (setsockopt (s, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&on, sizeof(on))) { fo = 1; dpmlogit (func, DP002, "setsockopt (IPV6_V6ONLY)", neterror()); } #else fo = 1; #endif } if (bind (s, ai->ai_addr, ai->ai_addrlen) < 0) { dpmlogit (func, DP002, "bind", neterror()); close (s); continue; } if (fo) { #ifdef IPV6_V6ONLY dpmlogit (func, "Was not able to set the IPV6_V6ONLY " "socket option on the IPv6 listen socket\n"); #else dpmlogit (func, "Was compiled on a system that does not " "support the IPV6_V6ONLY socket option\n"); #endif if (listen_ipv6only) { dpmlogit (func, "Not proceeding as the IPv6 only flag was specified\n"); return (CONFERR); } dpmlogit (func, "Incoming IPv4 will be accepted and handled as " "IPv4-mapped IPv6 addresses\n"); } listen_socks[num_listen_socks] = s; ++num_listen_socks; listen (s, 5) ; } freeaddrinfo (aitop); if (num_listen_socks == 0) { dpmlogit (func, "Could not listen on any sockets\n"); return (CONFERR); } nfds = -1; for (i=0; infds) nfds = listen_socks[i]; } ++nfds; #ifdef CSEC /* initialise the security context for the first time */ Csec_server_initContext (&sec_ctx, CSEC_SERVICE_TYPE_HOST, NULL); #endif /* main loop */ while (1) { /* check if any child has ended */ check_child_exit(); /* check if config parameters have changed */ if ((curtime = time (0)) > lastcheckconfig + CHKCONFIGINT) { lastcheckconfig = curtime; if ((p = getconfent ("DPMCOPYD", "MAX_WORKERS", 0))) maxchildren = atoi (p); } for (i=0; i < num_listen_socks; ++i) { s = listen_socks[i]; if (FD_ISSET (s, &readfd)) { FD_CLR (s, &readfd); fromlen = sizeof(from); rqfd = accept (s, (struct sockaddr *) &from, &fromlen); doit (rqfd); } } while (reqctr > 0) { if (nbchildren + 1 > maxchildren) break; pid = fork (); switch (pid) { case -1: dpmlogit (func, DP002, "fork", strerror (errno)); break; case 0: for (i=0; i < num_listen_socks; ++i) close (listen_socks[i]); Cinitlog ("dpmcopyd", logfile); procreq (); break; default: nbchildren++; dpmlogit (func, "decrementing reqctr\n"); reqctr--; } } /* regularly poll the DB for work */ if (reqctr == 0 && nbchildren < maxchildren && (curtime = time (0)) > lastdbpoll + DPM_DBPINGI) { lastdbpoll = curtime; bol = 1; while ((c = dpm_list_pending_req (&dbfd, bol, &dpm_req, 0, NULL, 0, &dblistptr)) == 0) { bol = 0; if (dpm_req.status != DPM_QUEUED4COPY) continue; dpmlogit (func, "incrementing reqctr (DB poll)\n"); reqctr++; } (void) dpm_list_pending_req (&dbfd, bol, &dpm_req, 0, NULL, 1, &dblistptr); /* free res */ } memcpy (&readfd, &readmask, sizeof(readmask)); timeval.tv_sec = CHECKI; timeval.tv_usec = 0; if (select (maxfds, &readfd, (fd_set *)0, (fd_set *)0, &timeval) < 0) { FD_ZERO (&readfd); } } (void) dpm_closedb (&dbfd); exit (0); } main(argc, argv) int argc; char **argv; { #if ! defined(_WIN32) struct main_args main_args; if ((maxfds = Cinitdaemon ("dpmcopyd", wait4child)) < 0) exit (SYERR); main_args.argc = argc; main_args.argv = argv; exit (dpmcopy_main (&main_args)); #else if (Cinitservice ("dpmcopyd", &dpmcopy_main)) exit (SYERR); #endif } void doit(s) int s; { int c; const char *clienthost = NULL; const char *clientip; int magic; char req_data[REQBUFSZ-3*LONGSIZE]; int req_type; if ((clientip = Cgetnetaddress (s, NULL, 0, &na_key, NULL, NULL, NI_NUMERICHOST, 0)) == NULL) { clientip = "unknown"; } #ifdef CSEC Csec_server_initContext (&sec_ctx, CSEC_SERVICE_TYPE_HOST, NULL); if (Csec_server_establishContext (&sec_ctx, s) < 0) { dpmlogit (func, "[%s]: Could not establish an authenticated connection: %s !\n", clientip, Csec_getErrorMessageSummary (LOGBUFSZ-140)); netclose (s); return; } Csec_server_getClientId (&sec_ctx, &Csec_mech, &Csec_auth_id); if (strcmp (Csec_mech, "ID") != 0 && Csec_isIdAService (Csec_mech, Csec_auth_id) < 0 || ! isTrustedHost (s, localhost, localdomain, "DPM", "TRUST")) { dpmlogit (func, "[%s]: Host is not trusted, identity provided was (%s,\"%s\")\n", clientip, Csec_mech, Csec_auth_id); sendrep (s, DPM_RC, EACCES); return; } #endif if ((c = getreq (s, &magic, &req_type, req_data, &clienthost)) == 0) { if (req_type == DPM_INCREQCTR) { dpmlogit (func, "inc_reqctr request from %s\n", clienthost); reqctr++; } } else { dpmlogit (func, "[%s]: Failure getting the request: %s\n", clientip, sstrerror(c)); } sendrep (s, DPM_RC, c); } void dpmcopy_set_errstring (s1, s2, s3, errstring, errstringsiz) char *s1; char *s2; char *s3; char *errstring; int errstringsiz; { int l; l = strlen (s1); strcpy (errstring, s1); if (s3) snprintf (errstring+l, errstringsiz-l, ": %s", s3); else if (*s2 && strstr (s2, "Failed for all SURLs") == NULL) snprintf (errstring+l, errstringsiz-l, ": %s", s2); } int getreq(s, magic, req_type, req_data, clienthost) int s; int *magic; int *req_type; char *req_data; const char **clienthost; { int l; unsigned int msglen; int n; char *rbp; char req_hdr[3*LONGSIZE]; serrno = 0; l = netread_timeout (s, req_hdr, sizeof(req_hdr), DPM_TIMEOUT); if (l == sizeof(req_hdr)) { rbp = req_hdr; unmarshall_LONG (rbp, n); *magic = n; unmarshall_LONG (rbp, n); *req_type = n; unmarshall_LONG (rbp, msglen); if (msglen > REQBUFSZ) { dpmlogit (func, DP046, REQBUFSZ); return (-1); } l = msglen - sizeof(req_hdr); n = netread_timeout (s, req_data, l, DPM_TIMEOUT); if (n > 0 && n == l) { if (*clienthost == NULL) { if ((*clienthost = Cgetnetaddress (s, NULL, 0, &na_key, NULL, NULL, 0, 0)) == NULL) { dpmlogit (func, "Could not find the address of the client\n"); return (SEINTERNAL); } } return (0); } l = n; } if (l > 0) dpmlogit (func, DP004, l); else if (l < 0) dpmlogit (func, DP002, "netread", neterror()); return (SEINTERNAL); } int upd_cpr(dbfd, rec_addrf, cpr_entry) struct dpm_dbfd *dbfd; dpm_dbrec_addr *rec_addrf; struct dpm_copy_filereq *cpr_entry; { (void) dpm_update_cpr_entry (dbfd, rec_addrf, cpr_entry); (void) dpm_end_tr (dbfd); if ((cpr_entry->status & 0xF000) == DPM_FAILED) nb_file_err++; return (0); } int upd_cpr2(dbfd, r_token, from_surl, to_surl, filesize, status, errstring, f_lifetime, cpr_entry) struct dpm_dbfd *dbfd; char *r_token; char *from_surl; char *to_surl; u_signed64 filesize; int status; char *errstring; time_t f_lifetime; struct dpm_copy_filereq *cpr_entry; { dpm_dbrec_addr rec_addrf; (void) dpm_start_tr (0, dbfd); if (dpm_get_cpr_by_surls (dbfd, r_token, from_surl, to_surl, cpr_entry, 1, &rec_addrf) == 0) { if (cpr_entry->status == DPM_ACTIVE) { cpr_entry->actual_size = filesize; cpr_entry->status = status; if (errstring) strcpy (cpr_entry->errstring, errstring); if (status == 0) cpr_entry->f_lifetime = f_lifetime; (void) dpm_update_cpr_entry (dbfd, &rec_addrf, cpr_entry); } } else cpr_entry->status = status; (void) dpm_end_tr (dbfd); if ((cpr_entry->status & 0xF000) == DPM_FAILED) nb_file_err++; return (0); } int get_copy_type(dbfd, dpm_req, cpr_entry, nbfiles) struct dpm_dbfd *dbfd; struct dpm_req *dpm_req; struct dpm_copy_filereq *cpr_entry; int *nbfiles; { int c; int dest_is_local; int i; int j = 0; dpm_dbrec_addr rec_addrf; int src_is_local; int surl_is_local; for (i = 0; i < dpm_req->nbreqfiles; i++) { (void) dpm_start_tr (0, dbfd); if (dpm_get_cpr_by_fullid (dbfd, dpm_req->r_token, i, cpr_entry, 1, &rec_addrf) < 0) { dpm_abort_tr (dbfd); continue; } if (cpr_entry->status != DPM_QUEUED) { /* No need to process */ dpm_abort_tr (dbfd); if (cpr_entry->status == DPM_ABORTED || (cpr_entry->status & 0xF000) == DPM_FAILED) nb_file_err++; continue; } surl_is_local = 0; if (strncmp (cpr_entry->from_surl, "srm://", 6) == 0) { if ((c = is_surl_local (cpr_entry->from_surl)) < 0) { cpr_entry->status = DPM_FAILED | EINVAL; strcpy (cpr_entry->errstring, "Bad SURL syntax"); (void) upd_cpr (dbfd, &rec_addrf, cpr_entry); continue; } else if (c) surl_is_local = 1; } else surl_is_local = 1; if (j == 0) src_is_local = surl_is_local; else if (surl_is_local != src_is_local) { cpr_entry->status = DPM_FAILED | EINVAL; strcpy (cpr_entry->errstring, "All transfers must be in the same direction"); (void) upd_cpr (dbfd, &rec_addrf, cpr_entry); continue; } surl_is_local = 0; if (strncmp (cpr_entry->to_surl, "srm://", 6) == 0) { if ((c = is_surl_local (cpr_entry->to_surl)) < 0) { cpr_entry->status = DPM_FAILED | EINVAL; strcpy (cpr_entry->errstring, "Bad SURL syntax"); (void) upd_cpr (dbfd, &rec_addrf, cpr_entry); continue; } else if (c) surl_is_local = 1; } else surl_is_local = 1; if (j == 0) dest_is_local = surl_is_local; else if (surl_is_local != dest_is_local) { cpr_entry->status = DPM_FAILED | EINVAL; strcpy (cpr_entry->errstring, "All transfers must be in the same direction"); (void) upd_cpr (dbfd, &rec_addrf, cpr_entry); continue; } if (j == 0) { if (src_is_local == 0 && dest_is_local == 0) { cpr_entry->status = DPM_FAILED | EINVAL; strcpy (cpr_entry->errstring, "src and dest are both remote"); (void) upd_cpr (dbfd, &rec_addrf, cpr_entry); continue; } } j++; } if (j == 0 && nb_file_err) return (-1); *nbfiles = j; if (src_is_local) return (dest_is_local ? 0 : 1); return (2); } void procreq() { int alloced_gids = 0; int c; struct dpm_copy_filereq cpr_entry; struct dpm_dbfd dbfd; struct dpm_req dpm_req; char errbuf[256]; char **fqan = NULL; gid_t *gids = NULL; int i; int nbfiles; int nbgids; char *p; static char proxy_env[sizeof(P_tmpdir)+CA_MAXDPMTOKENLEN+20]; dpm_dbrec_addr rec_addr; int status; char *voname = NULL; /* Connect to the database */ dpm_seterrbuf (errbuf, sizeof(errbuf)); memset (&dbfd, 0, sizeof(dbfd)); if (dpm_opendb (&dbfd) < 0) exit (SYERR); /* Get next request and mark it "active" */ (void) dpm_start_tr (0, &dbfd); if (dpm_get_next_req (&dbfd, DPM_QUEUED4COPY, &dpm_req, 1, &rec_addr) < 0) { dpm_abort_tr (&dbfd); (void) dpm_closedb (&dbfd); exit (serrno == ENOENT ? 0 : SYERR); } if (dpm_req.stime == 0) dpm_req.stime = time (0); dpm_req.status = DPM_ACTIVE; if (dpm_update_pending_entry (&dbfd, &rec_addr, &dpm_req) < 0) { dpm_abort_tr (&dbfd); (void) dpm_closedb (&dbfd); exit (serrno == ENOENT ? 0 : SYERR); } dpm_end_tr (&dbfd); nbgids = 1; gids = &dpm_req.r_gid; #ifdef CSEC if (dpm_req.r_uid) { dpm_client_setAuthorizationId (dpm_req.r_uid, dpm_req.r_gid, "GSI", dpm_req.client_dn); #ifdef VIRTUAL_ID #ifdef USE_VOMS if ((gids = Cdecode_groups (dpm_req.groups, &nbgids)) == NULL) goto free_voms_info; alloced_gids = 1; if ((fqan = calloc (nbgids, sizeof(char *))) == NULL) goto free_voms_info; if (Cns_getgrpbygids (nbgids, gids, fqan) < 0) goto free_voms_info; if ((voname = strdup (fqan[0])) == NULL) goto free_voms_info; if ((p = strchr (voname, '/'))) *p = '\0'; /* pass the VOMS auth data to the DPM */ dpm_client_setVOMS_data (voname, fqan, nbgids); #endif #endif } #endif dpmlogit (func, "processing request %s from %s\n", dpm_req.r_token, dpm_req.client_dn); strcpy (proxy_env, "X509_USER_PROXY="); (void) build_proxy_filename (proxy_env+16, dpm_req.r_token); putenv (proxy_env); unsetenv ("X509_USER_CERT"); unsetenv ("X509_USER_KEY"); /* process request according to copy type */ status = get_copy_type (&dbfd, &dpm_req, &cpr_entry, &nbfiles); switch (status) { case 0: status = dpmcopy_local (&dbfd, &dpm_req, &cpr_entry, nbfiles); break; case 1: status = dpmcopy_push (&dbfd, &dpm_req, &cpr_entry, nbfiles); break; case 2: status = dpmcopy_pull (&dbfd, &dpm_req, &cpr_entry, nbfiles); break; default: break; } (void) unlink (proxy_env + 16); /* remove delegated proxy */ /* Move the request to the non-pending queue */ (void) dpm_start_tr (0, &dbfd); if ((c = dpm_get_pending_req_by_token (&dbfd, dpm_req.r_token, &dpm_req, 1, &rec_addr)) < 0) { dpm_abort_tr (&dbfd); (void) dpm_closedb (&dbfd); exit (serrno == ENOENT ? 0 : SYERR); } if (dpm_delete_pending_entry (&dbfd, &rec_addr) < 0) { dpm_abort_tr (&dbfd); (void) dpm_closedb (&dbfd); exit (SYERR); } dpm_req.etime = time (0); if (nb_file_err == 0) dpm_req.status = DPM_SUCCESS; else if (nb_file_err != dpm_req.nbreqfiles) dpm_req.status = DPM_DONE; else { if (dpm_req.nbreqfiles == 1) dpm_req.status = cpr_entry.status; else dpm_req.status = DPM_FAILED | EINVAL; strcpy (dpm_req.errstring, "Failed for all SURLs"); } if (dpm_insert_xferreq_entry (&dbfd, &dpm_req) < 0) { dpm_abort_tr (&dbfd); (void) dpm_closedb (&dbfd); exit (SYERR); } dpm_end_tr (&dbfd); free_voms_info: free (voname); if (fqan) { for (i = 0; i < nbgids; i++) free (fqan[i]); free (fqan); } if (alloced_gids) free (gids); (void) dpm_closedb (&dbfd); exit (0); } #if ! defined(_WIN32) void wait4child() { } void check_child_exit() { pid_t pid; int status; while ((pid = waitpid (-1, &status, WNOHANG)) > 0) { dpmlogit (func, "process %d exiting with status %x\n", pid, status & 0xFFFF); nbchildren--; } } #endif lcgdm-1.10.0/dpmcopy/dpmcopyd.sysconfig.mysql0000644000175000017500000000243312134162334020604 0ustar ellertellert# # $Id: dpmcopyd.sysconfig.mysql,v 1.2 2009/01/25 23:30:55 szamsu Exp $ # # @(#)$RCSfile: dpmcopyd.sysconfig.mysql,v $ $Revision: 1.2 $ $Date: 2009/01/25 23:30:55 $ CERN/IT/ADC/CA Jean-Damien Durand # # should the dpmcopyd daemon run? # any string but "yes" will equivalent to "NO" # RUN_DPMCOPYDAEMON="yes" # # should we run with another limit on the number of file descriptors than the default? # any string will be passed to ulimit -n #ULIMIT_N=4096 # ############################################################################################### # Change and uncomment the variables below if your setup is different than the one by default # ############################################################################################### #ALLOW_COREDUMP="yes" ###################### # DPMCOPYD variables # ###################### # - DPM host : please change !!!!!! DPM_HOST= # - DPM Name Server host : please change !!!!!! DPNS_HOST= # - DPMCOPYD log file : #DPMCOPYDLOGFILE="/var/log/dpmcopy/log" # - DPM configuration file : #DPMCONFIGFILE="/opt/lcg/etc/DPMCONFIG" #################### # Globus variables # #################### # - gridmapdir location #GRIDMAPDIR=/etc/grid-security/gridmapdir # - grid-mapfile location #GRIDMAP=/etc/grid-security/grid-mapfile lcgdm-1.10.0/dpmcopy/dpmcopyd.sysconfig.oracle0000644000175000017500000000316512134162334020707 0ustar ellertellert# # $Id: dpmcopyd.sysconfig.oracle,v 1.2 2009/01/25 23:30:55 szamsu Exp $ # # @(#)$RCSfile: dpmcopyd.sysconfig.oracle,v $ $Revision: 1.2 $ $Date: 2009/01/25 23:30:55 $ CERN/IT/ADC/CA Jean-Damien Durand # # should the dpmcopyd daemon run? # any string but "yes" will equivalent to "NO" # RUN_DPMCOPYDAEMON="yes" # # should we run with another limit on the number of file descriptors than the default? # any string will be passed to ulimit -n #ULIMIT_N=4096 # ############################################################################################### # Change and uncomment the variables below if your setup is different than the one by default # ############################################################################################### #ALLOW_COREDUMP="yes" ###################### # DPMCOPYD variables # ###################### # - DPM host : please change !!!!!! DPM_HOST= # - DPM Name Server host : please change !!!!!! DPNS_HOST= # - DPMCOPYD log file : #DPMCOPYDLOGFILE="/var/log/dpmcopy/log" # - DPM configuration file : #DPMCONFIGFILE="/opt/lcg/etc/DPMCONFIG" ############################# # Oracle specific variables # ############################# # Is the database installed locally ? Any string but "yes" will be equivalent to "no" : DB_IS_LOCAL="no" # - Oracle Home : #ORACLE_HOME=/usr/lib/oracle/10.2.0.1/client # - Directory where tnsnames.ora resides : #TNS_ADMIN=/another/tnsadmin/directory #################### # Globus variables # #################### # - gridmapdir location #GRIDMAPDIR=/etc/grid-security/gridmapdir # - grid-mapfile location #GRIDMAP=/etc/grid-security/grid-mapfile lcgdm-1.10.0/dpmcopy/dpmcopyd.scripts.postgresql0000644000175000017500000002015111763665646021347 0ustar ellertellert#!/bin/sh # # dpmcopyd Start/Stop dpmcopyd # # chkconfig: - 93 17 # description: DPM COPY server daemon # # $Id: dpmcopyd.scripts.postgresql 6384 2012-06-06 14:39:34Z rocha $ # # @(#)$RCSfile: dpmcopyd.scripts.postgresql,v $ $Revision: 6384 $ $Date: 2012-06-06 16:39:34 +0200 (Wed, 06 Jun 2012) $ CERN/IT/ADC/CA Jean-Damien Durand # # ## PLEASE USE sysconfig FILE TO CHANGE THESE ENVIRONMENT VARIABLES # PREFIX=/opt/lcg GRIDMAPDIR=/etc/grid-security/gridmapdir export GRIDMAPDIR GRIDMAP=/etc/grid-security/grid-mapfile export GRIDMAP LD_LIBRARY_PATH=/opt/glite/lib:/opt/globus/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH CSEC_MECH=ID export CSEC_MECH DPMCOPYDLOGFILE=/var/log/dpmcopy/log DPMCONFIGFILE=/opt/lcg/etc/DPMCONFIG DPMUSER=dpmmgr DPMGROUP=dpmmgr sysname=`uname -s` # source function library if [ -r /etc/rc.d/init.d/functions ]; then . /etc/rc.d/init.d/functions DAEMON="daemon --check dpmcopyd" FAILURE=failure ECHO_FAILURE=echo_failure SUCCESS=success ECHO_SUCCESS=echo_success ECHO_END=echo if [ $sysname = "Linux" ]; then ECHOOPT=-n fi else DAEMON=eval FAILURE= ECHO_FAILURE= SUCCESS= ECHO_SUCCESS= ECHOOPT= ECHO_END= fi RETVAL=0 prog="dpmcopyd" PIDFILE=/var/run/dpmcopyd.pid PIDDIR=/var/run SUBSYS=/var/lock/subsys/dpmcopyd SUBSYSDIR=/var/lock/subsys [ -z "$SILENTSTOP" ] && SILENTSTOP=0 DPMCOPYD=$PREFIX/sbin/dpmcopyd DPMCOPYSHUTDOWN=$PREFIX/sbin/dpmcopy-shutdown if [ -r $PREFIX/etc/dpmcopyd.conf ]; then SYSCONFIGDPMCOPYD=$PREFIX/etc/dpmcopyd.conf elif [ -r /etc/sysconfig/dpmcopyd ]; then SYSCONFIGDPMCOPYD=/etc/sysconfig/dpmcopyd elif [ -r /etc/default/dpmcopyd ]; then SYSCONFIGDPMCOPYD=/etc/default/dpmcopyd fi # ## Blindly attempt to create useful directories # # [ ! -d $PIDDIR ] && mkdir -p $PIDDIR > /dev/null 2>&1 # [ ! -d $SUBSYSDIR ] && mkdir -p $SUBSYSDIR > /dev/null 2>&1 if [ $sysname = "HP-UX" ]; then export UNIX95=1 fi if [ $sysname = "SunOS" ]; then format4comm="fname" elif [ $sysname = "Darwin" ]; then format4comm="ucomm" else format4comm="comm" fi case "$1" in start) DPMUSERHOME=`finger $DPMUSER | grep -i directory: | cut -f 2 -d' '` X509_USER_CERT=/etc/grid-security/$DPMUSER/dpmcert.pem export X509_USER_CERT X509_USER_KEY=/etc/grid-security/$DPMUSER/dpmkey.pem export X509_USER_KEY netstat -an | egrep '[:.]5017' | egrep 'LISTEN *$' > /dev/null if [ $? -eq 0 ]; then echo $ECHOOPT "dpmcopyd already started: " [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "dpmcopyd already started: " RETVAL=0 else if [ -n "$SYSCONFIGDPMCOPYD" ]; then # ## Source the configuration # . $SYSCONFIGDPMCOPYD if [ "${RUN_DPMCOPYDAEMON}" != "yes" ]; then echo $ECHOOPT "$SYSCONFIGDPMCOPYD says NO: " [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "$SYSCONFIGDPMCOPYD says NO: " RETVAL=0 $ECHO_END exit $RETVAL fi export DPM_HOST export DPNS_HOST if [ -n "${ULIMIT_N}" ]; then ulimit -n ${ULIMIT_N} fi fi if [ ! -s "$DPMCONFIGFILE" ]; then echo $ECHOOPT "config file $DPMCONFIGFILE empty: " [ -n "$ECHO_FAILURE" ] && $ECHO_FAILURE "config file $DPMCONFIGFILE empty: " RETVAL=1 fi if [ $RETVAL -eq 0 ]; then echo $ECHOOPT "Starting $prog: " cd / mkdir -p `dirname $DPMCOPYDLOGFILE` chown $DPMUSER:$DPMGROUP `dirname $DPMCOPYDLOGFILE` if [ "${ALLOW_COREDUMP}" != "yes" ]; then $DAEMON "su $DPMUSER -c \"LD_LIBRARY_PATH=$LD_LIBRARY_PATH $DPMCOPYD -c $DPMCONFIGFILE -l $DPMCOPYDLOGFILE\"" else $DAEMON "su $DPMUSER -c \"mkdir -p $DPMUSERHOME/dpmcopy; cd $DPMUSERHOME/dpmcopy; hostname -f >> logstart; date >> logstart; umask 0; umask >> logstart; ulimit -c unlimited; pwd >> logstart; ulimit -c >> logstart; echo DAEMON $DPMCOPYD \`hostname -f\` >> logstart; LD_LIBRARY_PATH=$LD_LIBRARY_PATH $DPMCOPYD -c $DPMCONFIGFILE -l $DPMCOPYDLOGFILE\"" fi if [ $? -eq 0 ]; then [ -d $SUBSYSDIR ] && touch $SUBSYS if [ -d $PIDDIR ]; then pid=`ps -eo pid,ppid,$format4comm | grep " 1 dpmcopyd$" | awk '{print $1}'` # The point of $PIDFILE is that it kills only # the master daemon. rm -f $PIDFILE echo $pid > $PIDFILE fi [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "Starting $prog: " RETVAL=0 else [ -n "$ECHO_FAILURE" ] && $ECHO_FAILURE "Starting $prog: " RETVAL=1 fi fi fi $ECHO_END ;; stop) if [ -f $PIDFILE ]; then echo $ECHOOPT "Stopping $prog: " if [ -x $DPMCOPYSHUTDOWN ]; then $DPMCOPYSHUTDOWN -f -h `hostname` > /dev/null 2>&1 RETVAL=$? if [ $RETVAL -ne 0 ]; then kill -2 -`cat $PIDFILE` > /dev/null 2>&1 RETVAL=$? fi else kill -2 -`cat $PIDFILE` > /dev/null 2>&1 RETVAL=$? fi if [ $RETVAL -eq 0 ]; then rm -f $PIDFILE [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "Stopping $prog: " else [ -n "$ECHO_FAILURE" ] && $ECHO_FAILURE "Stopping $prog: " fi else # dpmcopyd might have been started by hand pid=`ps -eo pid,ppid,$format4comm | grep " 1 dpmcopyd$" | awk '{print $1}'` if [ -n "$pid" ]; then echo $ECHOOPT "Stopping $prog: " if [ -x $DPMCOPYSHUTDOWN ]; then $DPMCOPYSHUTDOWN -f -h `hostname` > /dev/null 2>&1 RETVAL=$? if [ $RETVAL -ne 0 ]; then kill -2 -$pid > /dev/null 2>&1 RETVAL=$? fi else kill -2 -$pid > /dev/null 2>&1 RETVAL=$? fi if [ $RETVAL -eq 0 ]; then [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "Stopping $prog: " else [ -n "$ECHO_FAILURE" ] && $ECHO_FAILURE "Stopping $prog: " fi else echo $ECHOOPT "dpmcopyd already stopped: " [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "dpmcopyd already stopped: " [ $SILENTSTOP -eq 0 ] && RETVAL=0 || RETVAL=1 fi fi lpid="X" while [ "x$lpid" != "x" ]; do sleep 1 #Does not seem to work on SunOS ;-) lpid=`ps -eo pid,ppid,$format4comm | grep " 1 dpmcopyd$" | awk '{print $1}'` done [ -d $SUBSYSDIR ] && rm -f $SUBSYS $ECHO_END ;; restart | force-reload) $0 stop if [ $? -eq 0 -o $SILENTSTOP -eq 0 ]; then sleep 1 $0 start RETVAL=$? else RETVAL=0 fi ;; condrestart | try-restart) SILENTSTOP=1 export SILENTSTOP $0 restart RETVAL=$? ;; reload) ;; status) pid=`ps -eo pid,ppid,$format4comm | grep " 1 dpmcopyd$" | awk '{print $1}'` if [ -n "$pid" ]; then echo $ECHOOPT "dpmcopyd (pid $pid) is running..." $ECHO_SUCCESS $ECHO_END RETVAL=0 else if [ -f $PIDFILE ]; then pid=`head -1 $PIDFILE` if [ "$pid" != "" ] ; then echo $ECHOOPT "dpmcopyd dead but pid file exists" $ECHO_FAILURE $ECHO_END RETVAL=1 else echo $ECHOOPT "dpmcopyd dead" $ECHO_FAILURE $ECHO_END RETVAL=1 fi else if [ -f $SUBSYS ]; then echo $ECHOOPT "dpmcopyd dead but subsys ($SUBSYS) locked" RETVAL=2 else echo $ECHOOPT "dpmcopyd is stopped" RETVAL=3 fi $ECHO_FAILURE $ECHO_END fi fi ;; *) echo "Usage: $0 {start|stop|status|restart|condrestart}" RETVAL=1 ;; esac exit $RETVAL lcgdm-1.10.0/dpmcopy/oralink.mk0000644000175000017500000000114212200740514015653 0ustar ellertellert# # Copyright (C) 2007 by CERN/IT/GD/ITR # All rights reserved # # @(#)$RCSfile: oralink.mk,v $ $Revision: 1.1 $ $Date: 2008/09/24 11:25:00 $ CERN IT-GD/ITR Jean-Philippe Baud # Link dpmcopyd with Oracle libraries. ifdef ORACLE_SHARE include $(ORACLE_SHARE)/demo_proc_ic.mk else include $(ORACLE_HOME)/precomp/lib/env_precomp.mk endif ifdef ORACLE_LIB LIBHOME=$(ORACLE_LIB) endif PROLDLIBS=$(LLIBCLNTSH) $(LLIBCLIENT) $(LLIBSQL) $(STATICTTLIBS) PROLDLIBS=$(LLIBCLNTSH) $(LLIBCLIENT) $(LLIBSQL) dpmcopyd: $(SRV_OBJS) $(CC) -o dpmcopyd $(CLDFLAGS) $(SRV_OBJS) $(LIBS) -L$(LIBHOME) $(PROLDLIBS) lcgdm-1.10.0/dpmcopy/dpmcopy_pull.c0000644000175000017500000002134512245612447016561 0ustar ellertellert/* * Copyright (C) 2007-2008 by CERN/IT/GD/ITR * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: dpmcopy_pull.c,v $ $Revision: 1.1 $ $Date: 2008/09/24 11:25:00 $ CERN IT-GD/ITR Jean-Philippe Baud"; #endif /* not lint */ /* dpmcopy_pull - copy files when source is remote and target is local */ #include #include #include #include #include #if !defined(_WIN32) #include #endif #include "dpm.h" #include "dpm_api.h" #include "dpm_server.h" #include "dpmcopy_server.h" #include "serrno.h" #define DEFPOLLINT 5 extern int nb_file_err; int dpmcopy_pull (struct dpm_dbfd *dbfd, struct dpm_req *dpm_req, struct dpm_copy_filereq *cpr_entry, int nbfiles) { char errbuf[256]; char errstring[256]; u_signed64 filesize; struct dpm_filestatus *filestatuses; int *filstatus = NULL; char **from_surls; char func[16]; struct dpm_getfilestatus *getfilestatuses = NULL; int i; int j = 0; int nbgetreplies; int nbputreplies; int nbreplies; char *p; static char *protocols[] = {"gsiftp"}; struct dpm_putfilereq *putfilereqs; struct dpm_putfilestatus *putfilestatus = NULL; char *q; int r = 0; int r1; char *r_tokeng; char r_tokenp[CA_MAXDPMTOKENLEN+1]; dpm_dbrec_addr rec_addrf; char srm_endpoint[256]; int status; int statusg; strcpy (func, "dpmcopy_pull"); if (nbfiles == 0) return (0); /* nothing to be done */ nb_file_err = 0; /* build the get/put requests */ if ((from_surls = calloc (nbfiles, sizeof(char *))) == NULL || (putfilereqs = calloc (nbfiles, sizeof(struct dpm_putfilereq))) == NULL || (filstatus = calloc (nbfiles, sizeof(int))) == NULL) { dpm_req->status = DPM_FAILED | ENOMEM; return (-1); } for (i = 0; i < dpm_req->nbreqfiles; i++) { (void) dpm_start_tr (0, dbfd); if (dpm_get_cpr_by_fullid (dbfd, dpm_req->r_token, i, cpr_entry, 1, &rec_addrf) < 0) { dpm_abort_tr (dbfd); continue; } if (cpr_entry->status != DPM_QUEUED) { /* No need to process */ dpm_abort_tr (dbfd); if (cpr_entry->status == DPM_ABORTED || (cpr_entry->status & 0xF000) == DPM_FAILED) nb_file_err++; continue; } if ((p = strdup (cpr_entry->from_surl)) == NULL || (q = strdup (cpr_entry->to_surl)) == NULL) { cpr_entry->status = DPM_FAILED | ENOMEM; (void) upd_cpr (dbfd, &rec_addrf, cpr_entry); continue; } cpr_entry->status = DPM_ACTIVE; (void) upd_cpr (dbfd, &rec_addrf, cpr_entry); from_surls[j] = p; (putfilereqs+j)->to_surl = q; (putfilereqs+j)->f_lifetime = cpr_entry->f_lifetime; (putfilereqs+j)->f_type = cpr_entry->f_type == '_' ? '\0' : cpr_entry->f_type; strcpy ((putfilereqs+j)->s_token, cpr_entry->s_token); (putfilereqs+j)->ret_policy = cpr_entry->ret_policy == '_' ? '\0' : cpr_entry->ret_policy; (putfilereqs+j)->ac_latency = cpr_entry->ac_latency == '_' ? '\0' : cpr_entry->ac_latency; j++; } if (j == 0) return (0); /* nothing to be done */ dpm_seterrbuf (errbuf, sizeof(errbuf)); if (get_srm_endpoint (from_surls[0], srm_endpoint, sizeof(srm_endpoint)) < 0) { dpm_req->status = DPM_FAILED | EINVAL; strcpy (dpm_req->errstring, "SRM endpoint too long"); return (-1); } /* get source TURL(s) */ dpmlogit (func, "calling srmv2_get\n"); errbuf[0] = '\0'; r_tokeng = NULL; statusg = srmv2_get (j, from_surls, 1, protocols, dpm_req->retrytime, &r_tokeng, &nbgetreplies, &getfilestatuses); if (r_tokeng) dpmlogit (func, "srmv2_get returned request token %s\n", r_tokeng); /* wait for any source TURL ready */ while (1) { for (i = 0; i < j; i++) { if (*(filstatus+i)) continue; /* already processed */ if (! getfilestatuses) { if (statusg < 0) { *(filstatus+i) = DPM_FAILED | serrno; dpmcopy_set_errstring ("get failed", errbuf, NULL, errstring, sizeof(errstring)); (void) upd_cpr2 (dbfd, dpm_req->r_token, from_surls[i], (putfilereqs+i)->to_surl, 0, *(filstatus+i), errstring, 0, cpr_entry); } continue; } if (statusg >= 0 && ((getfilestatuses+i)->status == DPM_QUEUED || (getfilestatuses+i)->status == DPM_ACTIVE)) continue; if ((getfilestatuses+i)->status != DPM_READY) { if ((getfilestatuses+i)->status < DPM_READY) *(filstatus+i) = statusg < 0 ? (DPM_FAILED | serrno) : statusg; else *(filstatus+i) = (getfilestatuses+i)->status; dpmcopy_set_errstring ("get failed", errbuf, (getfilestatuses+i)->errstring, errstring, sizeof(errstring)); (void) upd_cpr2 (dbfd, dpm_req->r_token, from_surls[i], (putfilereqs+i)->to_surl, 0, *(filstatus+i), errstring, 0, cpr_entry); continue; } /* source TURL ready , get file size */ errbuf[0] = '\0'; if (srmv2_getfilesize (from_surls[i], &filesize, dpm_req->retrytime) < 0) { *(filstatus+i) = DPM_FAILED | serrno; (void) upd_cpr2 (dbfd, dpm_req->r_token, from_surls[i], (putfilereqs+i)->to_surl, 0, *(filstatus+i), "could not get file size", 0, cpr_entry); continue; } (putfilereqs+i)->requested_size = filesize; /* get destination TURL */ errbuf[0] = '\0'; r1 = 0; putfilestatus = NULL; *r_tokenp = '\0'; dpmlogit (func, "calling dpm_put\n"); status = dpm_put (1, putfilereqs+i, 1, protocols, NULL, (dpm_req->flags & 1), dpm_req->retrytime, r_tokenp, &nbputreplies, &putfilestatus); if (*r_tokenp) dpmlogit (func, "dpm_put returned request token %s\n", r_tokenp); /* wait for destination TURL ready */ while (status == DPM_QUEUED || status == DPM_ACTIVE) { dpm_free_pfilest (nbputreplies, putfilestatus); sleep ((r1++ == 0) ? 1 : DEFPOLLINT); errbuf[0] = '\0'; putfilestatus = NULL; status = dpm_getstatus_putreq (r_tokenp, 0, NULL, &nbputreplies, &putfilestatus); } if (! putfilestatus) { *(filstatus+i) = status < 0 ? (DPM_FAILED | serrno) : status; dpmcopy_set_errstring ("put failed", errbuf, NULL, errstring, sizeof(errstring)); goto upd_cfr; } if (putfilestatus->status != DPM_READY) { if (putfilestatus->status < DPM_FAILED) *(filstatus+i) = status < 0 ? (DPM_FAILED | serrno) : status; else *(filstatus+i) = putfilestatus->status; dpmcopy_set_errstring ("put failed", errbuf, putfilestatus->errstring, errstring, sizeof(errstring)); goto upd_cfr; } /* destination TURL ready, copy file */ errbuf[0] = '\0'; *(filstatus+i) = DPM_ACTIVE; dpmlogit (func, "copying %s to %s\n", (getfilestatuses+i)->turl, putfilestatus->turl); status = dpm_copyfile ((getfilestatuses+i)->turl, putfilestatus->turl, 5, 0); filestatuses = NULL; if (status < 0) { dpmlogit (func, "dpm_copyfile returned %d, serrno = %d\n", status, serrno); status = DPM_FAILED | serrno; dpmcopy_set_errstring ("copy failed", errbuf, NULL, errstring, sizeof(errstring)); (void) dpm_abortfiles (r_tokenp, 1, &putfilestatus->to_surl, &nbreplies, &filestatuses); } else { dpmlogit (func, "dpm_copyfile returned %d\n", status); errbuf[0] = '\0'; dpmlogit (func, "calling dpm_putdone\n"); status = dpm_putdone (r_tokenp, 1, &putfilestatus->to_surl, &nbreplies, &filestatuses); if (status < 0) { status = DPM_FAILED | serrno; dpmcopy_set_errstring ("putdone failed", errbuf, NULL, errstring, sizeof(errstring)); } else errstring[0] = '\0'; } dpm_free_filest (nbreplies, filestatuses); *(filstatus+i) = status ? status : DPM_DONE; /* try to get target SURL lifetime */ if (status == 0) { dpm_free_pfilest (nbputreplies, putfilestatus); putfilestatus = NULL; if (dpm_getstatus_putreq (r_tokenp, 0, NULL, &nbputreplies, &putfilestatus) == 0 && putfilestatus) cpr_entry->f_lifetime = putfilestatus->f_lifetime; } upd_cfr: filestatuses = NULL; (void) srmv2_relfiles (r_tokeng, 1, &(getfilestatuses+i)->from_surl, &nbreplies, &filestatuses, dpm_req->retrytime); dpm_free_filest (nbreplies, filestatuses); (void) upd_cpr2 (dbfd, dpm_req->r_token, from_surls[i], (putfilereqs+i)->to_surl, (*(filstatus+i) == DPM_DONE) ? filesize : 0, (*(filstatus+i) == DPM_DONE) ? 0 : *(filstatus+i), errstring, cpr_entry->f_lifetime, cpr_entry); dpm_free_pfilest (nbputreplies, putfilestatus); } for (i = 0; i < j; i++) { if (*(filstatus+i) == 0 || *(filstatus+i) == DPM_ACTIVE) break; } if (i >= j) break; /* no more pending file request */ dpm_free_gfilest (nbgetreplies, getfilestatuses); getfilestatuses = NULL; errbuf[0] = '\0'; sleep ((r++ == 0) ? 1 : DEFPOLLINT); statusg = srmv2_getstatus_getreq (r_tokeng, 0, NULL, srm_endpoint, &nbgetreplies, &getfilestatuses, dpm_req->retrytime); } if (r_tokeng) free (r_tokeng); return (0); } lcgdm-1.10.0/CHANGES-long0000644000175000017500000115610211763665646014201 0ustar ellertellert2012-04-03 10:58 rocha - Before 1.8.3-0: * rpm/lcg-dm-common.spec: Added missing Cthread_env.h file * dpm/dpm_procreq.c: Fixed #438 (dpm segfault on i/o errors). * rpm/epel/lcgdm-oracle.spec: Added the init.d script removal if not a symlink. * rpm/epel/lcgdm-meta.spec: Added lfc-dli dependency also to the mysql metapackage. * rpm/epel/lcgdm.spec: added removal scriptlets for old scripts in init.d * rpm/epel/lcgdm.spec: fixed name of NSCONFIG.templ file for the dpm-name-server * rpm/epel/lcgdm.spec: giving up on .gz sbin man pages (brp-compress has only hardcoded dirs). * rpm/epel/lcgdm-oracle.spec: gz man pages in sbin * rpm/epel/lcgdm.spec: point to .gz man pages in sbin daemons. * rpm/epel/lcgdm-meta.spec: added lfc-dli to the lfc metapackage * rpm/epel/lcgdm-meta.spec: Force dependency on dpm-yaim >= 4.2.6 * rpm/epel/lcgdm-meta.spec: metapackages version must stay the same as the actual packages * rpm/epel/lcgdm-oracle.spec: Made oracle-proc selection dist and arch dependent. * rpm/epel/lcgdm-meta.spec: Added oracle metapackages * rpm/epel/lcgdm-oracle.spec: changed location of oracle proc client to have multiple versions * rpm/epel/lcgdm-oracle.spec: Enable build of argus cli tools. * rpm/epel/lcgdm-oracle.spec: Take oracle proc from our www area, fixed names of sql scripts * ns/Imakefile.dpns: Fixed type in Imakefile for dpns * rpm/epel/lcgdm-oracle.spec: added spec file for oracle packages * scripts/proc-init-cern-afs: oracle version changed from 10204 to 10205 2011-08-19 16:10 rocha - Before 1.8.2-0: * ns/Cns_chkperm.c: protect against calls with fileid == 0 * dpm/dpm_libpq_ifce.c, dpm/dpm_mysql_ifce.c, dpm/dpm_oracle_ifce.pc: Merge from trunk: Rollback fix for : take mutex before selecting next request to avoid 2 threads picking same * dpm/dpm_libpq_ifce.c, dpm/dpm_mysql_ifce.c, dpm/dpm_oracle_ifce.pc: Merge from trunk: take mutex before selecting next request to avoid 2 threads picking same * dpm/dpm.man: Merge from trunk: document value of DPM_MAXNBTHREADS * dpm/dpm.man, ns/nsdaemon.man, srmv2.2/srmv2.2.man: Merge from trunk: document the limits on the number of threads that can be configured * dpm/dpm_proclreq.c: Merge from trunk: fix typo * dpm/dpm_proclreq.c: Merge from trunk: add log entry when calling Cns_getgrpbygids * dpm/dpm_main.c: Merge from trunk: protect against too many threads configured * dpm/poolmgr.c: Merge from trunk: protect against next_elem becoming greater than fs_veclen * ns/Cns_procreq.c: Instrument Cns_statg to be able to send NotAvailable notifications through SEMsg * scripts/lcg-info-provider-lfc: Further GLUE2 fixes, bug #62209 for details * dpm/dpm_oracle_ifce.pc, ns/Cns_oracle_ifce.pc: Merge from trunk: "Oracle password soon to expire" corresponds to sqlcode 28002 and not -28002 * ns/Imakefile: Merge from trunk: clean arguspoll as well * dpm/dpm_oracle_ifce.pc: Merge from trunk: typo * CHANGES: Merge from trunk: fix for bug 46337 * dpm/poolmgr.c: Merge from trunk: rebuild filesystem selection vector in case one of the fs statuses change * dpm/dpm_oracle_ifce.pc, ns/Cns_oracle_ifce.pc: Merge from trunk: log but accept ORA-28002 as successful login * dpm/poolmgr.c, h/dpm_server.h: Merge from trunk: avoid memory leak when pools are deleted * scripts/lcg-info-provider-lfc: glue 2 support and bugfix - #62209 & #59704 * CHANGES: Merge from trunk: add description of more bug fixes * dpm/dpm_procreq.c, dpm/poolmgr.c: Merge from trunk: avoid race condition when deleting a pool and recreating it with same name in a very very short period of time * ns/send2nsd.c: Merge from trunk: avoid to display garbage in getreplicas, getgrpmap and getusrmap when the client is newer than the server * dpm/dpm_oracle_ifce.pc, ns/Cns_oracle_ifce.pc: Merge from trunk: LFC_oracle fails to start when the connection string is too long (bug #83551) * rpm/LFC-oracle.spec: remove automatic dependency generation - https://svnweb.cern.ch/trac/lcgdm/ticket/142 * dpm/dpm_libpq_ifce.c, dpm/dpm_mysql_ifce.c, dpm/dpm_oracle_ifce.pc, ns/Cns_libpq_ifce.c, ns/Cns_mysql_ifce.c, ns/Cns_oracle_ifce.pc: Merge from trunk: make sure , and are included for xxx_get_dbconf * dicomcopy/dicomcopyd.man, dli/lfc-dli.man, dpm/dpm.man, dpmcopy/dpmcopyd.man, ns/nsdaemon.man, srmv1/srmv1.man, srmv2.2/srmv2.2.man, srmv2/srmv2.man: Merge from trunk: document the possibility to send the logs to syslog * h/Imakefile: added install of missing Clogit.h * dicomcopy/dicomcopy_serv.c, dpm/dpm_libpq_ifce.c, dpm/dpm_main.c, dpm/dpm_mysql_ifce.c, dpm/dpm_oracle_ifce.pc, dpm/dpm_proclreq.c, dpmcopy/dpmcopy_main.c, h/Cns_server.h, h/dpm_server.h, ns/Cns_libpq_ifce.c, ns/Cns_main.c, ns/Cns_mysql_ifce.c, ns/Cns_oracle_ifce.pc, srmv1/srmv1.c, srmv1/srmv1_procreq.c, srmv2.2/srmv2.c, srmv2.2/srmv2_dirreq.c, srmv2.2/srmv2_spacereq.c, srmv2.2/srmv2_xferreq.c, srmv2/srmv2.c, srmv2/srmv2_spacereq.c, srmv2/srmv2_xferreq.c: Merge from trunk: Parse the DB config file in the DB module and not in the daemon itself. Suppress some global variables as a prerequisite for Name Server library. * rpm/lcg-dm-common.spec, solaris/prototype.lcgdmcmn: Add the possibility to send logs to syslog and have log levels * dicomcopy/dicomcopy_serv.c, dli/dli.c: fix syslog feature * common/Cinitlog.man, common/Clogit.c, common/Clogit.man, common/Cvlogit.man, common/Imakefile, dicomcopy/dicomcopy_serv.c, dli/dli.c, dli/dlilogit.c, dpm/dpm_main.c, dpm/dpmlogit.c, dpmcopy/dpmcopy_main.c, h/Clogit.h, ns/Cns_main.c, ns/nslogit.c, srmv1/srmlogit.c, srmv1/srmv1.c, srmv2.2/srmlogit.c, srmv2.2/srmv2.c, srmv2/srmlogit.c, srmv2/srmv2.c: Merge from trunk: Add the possibility to send logs to syslog and have log levels. Suppress some global variables as a prerequisite for Name Server library. * config/site.def: rolling out changes commited by mistake * config/site.def, ns/nsarguspoll.man, rfio/rfstat.man: Added missing man pages from the merge. * ns/Imakefile.dpns, ns/Imakefile.lfc, rpm/DPM-mysql.spec, rpm/DPM-oracle.spec, rpm/DPM-postgres.spec, rpm/LFC-mysql.spec, rpm/LFC-oracle.spec, rpm/LFC-postgres.spec: Merge from trunk: add dpns-arguspoll/lfc-arguspoll man page * rfio/rfdir.man: Merge from trunk: fix typo * dpm/dpm-buildfsv.c, dpm/dpm-buildfsv.man, dpm/dpm_buildfsv.c: Merge from trunk: take filesystem status into account when building the fs vector * ns/Cns_readdir.man, ns/Cns_readdirc.man, ns/Cns_readdirg.man, ns/Cns_readdirx.man, ns/Cns_readdirxc.man, ns/Cns_readdirxp.man, ns/Cns_readdirxr.man: Merge from trunk: SENOSHOST and SENOSSERV cannot be returned as error * ns/Cns_procreq.c: Merge from trunk: Bug in LFC 1.8.0 in read only mode (bug #82941) * dicomcopy/dicomcopyd.scripts.mysql, dicomcopy/dicomcopyd.scripts.oracle, dicomcopy/dicomcopyd.scripts.postgresql, dli/lfc-dli.scripts, dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, dpm/dpm.scripts.postgresql, dpmcopy/dpmcopyd.scripts.mysql, dpmcopy/dpmcopyd.scripts.oracle, dpmcopy/dpmcopyd.scripts.postgresql, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/dpnsdaemon.scripts.postgresql, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, ns/lfcdaemon.scripts.postgresql, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv1/srmv1.scripts.postgresql, srmv2.2/srmv2.2.scripts.mysql, srmv2.2/srmv2.2.scripts.oracle, srmv2.2/srmv2.2.scripts.postgresql, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle, srmv2/srmv2.scripts.postgresql: Merge from trunk:fix startup script when logfile does not contain a slash (bug #77388) * rfio/Imakefile, rpm/DPM-client.spec, rpm/DPM-mysql.spec, solaris/prototype.dpmclient: Merge from trunk: add missing rfstat man page (bug #83247). * dpm/dpm_procreq.c: Merge from trunk: remove some 'free' statements incorrectly added in the previous patch * dpm/dpm_mysql_tbl.sql, dpm/dpm_oracle_tbl.sql, dpm/dpm_postgresql_tbl.sql: merge from trunk: update DB schema version to 3,3,0 * scripts/upgrades/dpm-db-320-to-330: clearing from bad patch. * dpm/dpm-addfs.c, dpm/dpm-modifyfs.c, dpm/dpm-qryconf.c: merge from trunk: add --weight option to help text * dpm/dpm_procreq.c: merge from trunk: fix a few memory leaks and a few typos in addpool and modifypool. * dpm/dpm-buildfsv.c, dpm/dpm-buildfsv.man, dpm/dpm_buildfsv.c: Cleaning up failed patch. * dpm/dpm-buildfsv.c, dpm/dpm-buildfsv.man, dpm/dpm_buildfsv.c, scripts/upgrades/dpm-db-320-to-330: merge from trunk: DPM filesystem selection based on assign weights (bug #82361). * ns/Cns_procreq.c: First implementation of the NotifyAddReplica instrumentation * VERSION: merge from trunk: 1.8.2-0 * dpm/dpm_procreq.c: merge from trunk: No error message if too many groups specified in dpm-modifypool (bug #82339), DPM filesystem selection based on assign weights (bug #82361) * dpm/Imakefile, dpm/dpm-addfs.c, dpm/dpm-addfs.man, dpm/dpm-drain.c, dpm/dpm-modifyfs.c, dpm/dpm-modifyfs.man, dpm/dpm-qryconf.c, dpm/dpm-qryconf.man, dpm/dpm.i, dpm/dpm2.i, dpm/dpm_addfs.c, dpm/dpm_addfs.man, dpm/dpm_getpoolfs.c, dpm/dpm_getpoolfs.man, dpm/dpm_libpq_ifce.c, dpm/dpm_modifyfs.c, dpm/dpm_modifyfs.man, dpm/dpm_mysql_ifce.c, dpm/dpm_mysql_tbl.sql, dpm/dpm_oracle_ifce.pc, dpm/dpm_oracle_tbl.sql, dpm/dpm_postgresql_tbl.sql, dpm/poolmgr.c, dpm/send2dpm.c, dpm/sendrep.c, h/dpm_api.h, h/dpm_constants.h, h/dpm_server.h, h/dpm_struct.h, rpm/DPM-dicom.spec, rpm/DPM-mysql.spec, rpm/DPM-oracle.spec, rpm/DPM-postgres.spec, solaris/prototype.dpmdicommys, solaris/prototype.dpmdicompsql, solaris/prototype.dpmmys, solaris/prototype.dpmora, solaris/prototype.dpmpsql: merge from trunk: DPM filesystem selection based on assign weights (bug #82361). * dpm/dpm_addpool.man, dpm/dpm_modifypool.man, dpm/dpm_reservespace.man, dpm/dpm_updatespace.man: merge from trunk: No error message if too many groups specified in dpm-modifypool (bug #82339) * CHANGES: merge from trunk: add comments for bugs 82339, 82361 and 82403 * h/Cns_api.h: merge from trunk: change d_name declaration from d_name[1] to d_name[256] (bug #82403) * security/Csec_api_loader.c: merge from trunk: allow for symbols without _pthr suffix in case of fallback from _pthr plugin to non-pthr plugin (second attempt) * ns/Cns_procreq.c: Add the instrumentation to send a notification through SEMsg when an SFN is deleted * ns/Cns_procreq.c: Daemon instrumentation to use SEMsg to send notifications * ns/Cns_main.c: Init the SEMsg producer when the daemon starts * config/site.def: Add SEMsg support * ns/dpnsdaemon.sysconfig.mysql, ns/dpnsdaemon.sysconfig.oracle, ns/dpnsdaemon.sysconfig.postgresql, ns/lfcdaemon.sysconfig.mysql, ns/lfcdaemon.sysconfig.oracle, ns/lfcdaemon.sysconfig.postgresql, ns/nsdaemon.sysconfig: Set the SEMsg config file in the sysconfig scripts * ns/Imakefile, ns/Imakefile.cns, ns/Imakefile.dpns, ns/Imakefile.lfc: Nameserver makefile additions to support SEMsg * configure: Add SEMsg support to the configure script * rpm/Makefile: ETICS does not resolve project deps via rpm * rpm/DPM-client.spec, rpm/DPM-dicom.spec, rpm/DPM-interfaces-py26.spec, rpm/DPM-mysql.spec, rpm/LFC-client.spec, rpm/LFC-interfaces-py26.spec, rpm/LFC-mysql.spec, rpm/Makefile, rpm/lcg-dm-common.spec: add BuildRequires and persistence of EXTRA_CONFIGURE_OPTIONS * rpm/Makefile: Fixed issue in make rpm - arch comparison was broken when finding libdir 2011-04-07 15:37 baud - Before 1.8.1-1: * CHANGES, VERSION: 1.8.1-1 tag * rfio/Imakefile: change PREFIX in startup script for EMI * config/darwin.cf: pass -dynamiclib option to gcc to produce dynamic libraries * shlib/Imakefile: fix typos * common/u64subr.c, dpm/dpm-reservespace.c, dpm/dpm-reservespace.man, dpm/dpm-updatespace.c, dpm/dpm-updatespace.man, h/u64subr.h: add --si option to dpm-reservespace and dpm-updatespace (A. Forti) * rfio/preseek.c, rfio/preseek64.c: return EINVAL if iov_base or iov_len is negative * shlib/Imakefile: link liblcgdm.so to libdl * config/site.def: remove references to /usr/spool * dpm/dpm_main.c, dpm/dpm_proclreq.c, h/dpm_server.h: fix a few more warnings * dpm/dpm_procreq.c: log RFIO errors * dpm/dpm_procreq.c, h/dpm_server.h: suppress warnings at compile time define function prototypes for dpm_getonereqsummary, dpm_relonefile and dpm_updpoolfreespace * ns/Cns.i: export dpns_listreplicax and lfc_listreplicax methods export dpns_creat instead of dpns_creatg * rfio/lseek.c: return EINVAL if SEEK_SET and offset < 0 * rfio/fread.c: rfio_fread must return the number of items successfully read, i.e. should not include partial records * rfio/lseek64.c: return EINVAL and not EOVERFLOW if SEEK_SET and offset < 0 * ns/nsls.man: Feature request for dpns-ls -h (human readable) (bug #20298) * ns/nsls.c: Feature request for dpns-ls -h (human readable) (bug #20298) 2011-03-11 17:20 baud - Before 1.8.1-0: * CHANGES: 1.8.1 retag * config/Imake.rules, rpm/DPM-client.spec, rpm/DPM-mysql.spec, rpm/LFC-client.spec, rpm/LFC-mysql.spec, rpm/lcg-dm-common.spec, shlib/Imakefile: No sonames in libraries (bug #57528) * CHANGES-long: 1.8.1-0 retag * rpm/DPM-client.spec, rpm/DPM-dicom.spec, rpm/DPM-interfaces-py25.spec, rpm/DPM-interfaces-py26.spec, rpm/DPM-mysql.spec, rpm/DPM-oracle.spec, rpm/DPM-postgres.spec, rpm/LFC-client.spec, rpm/LFC-interfaces-py25.spec, rpm/LFC-interfaces-py26.spec, rpm/LFC-mysql.spec, rpm/LFC-oracle.spec, rpm/LFC-postgres.spec, rpm/lcg-dm-common.spec: set AutoReqProv = yes (strong requirement from EMI project) * dpm/dpm-listspaces: fix GlueSAExpirationMode when space is Volatile or Durable (GGUS 67503) * CHANGES-long: 1.8.1-0 * VERSION: 1.8.1 tag * CHANGES: 1.8.1 tag * dpm/dpm-drain.c: only count the size of files actually drained * dpm/poolmgr.c: DPM 1.8: dpm-modifyfs --st RDONLY doesn't update FS (bug #78968) * rpm/sl6.spec.requires, scripts/get-platform-os: SL6 support * dpm/dpm-drain.c, dpm/dpm-replicate.c: use rfio_serror for the error messages coming from dpm_replicate * dpm/dpm_replicate.c: fix typo * dpm/dpm-listspaces: revision 5510 from Michel Jouvin * rfio/fclose.c, rfio/feof.c, rfio/ferror.c, rfio/fflush.c, rfio/fread.c, rfio/fseek.c, rfio/fseeko64.c, rfio/ftell.c, rfio/ftello64.c, rfio/fwrite.c, rfio/getc.c, rfio/pclose.c, rfio/pwrite.c: include to suppress warning at compile time on SL6 * dpm/dpm_proclreq.c: log TURL info including selected protocol (Jeff) * dpm/dpm_replicate.c: fix TURL/PFN syntax for rfio protocol (Dimitar) * ns/nsarguspoll.c: initialize response pointer to avoid crashes when create_xacml_request fails * rfio/rfio_calls.c: allow to use protocol V3 (RFIO_STREAM) in third party copy * rfio/open64.c: code cleanup * dpm/dpm-drain.c: attempt to fix end of thread processing * rfio/rfcat.man, rfio/rfcp.man: document that the default mode is v3 (streaming mode) * dpm/dpm_replicate.c: fix syntax of source rfio TURL (Dimitar) * ns/nsarguspoll.c: fix 2 problems, especially dpns_modifyusrmap called instead of dpns_modifyusrmap (Dimitar) * shlib/Imakefile: liblcgdm.so now links properly to libdl * dpm/dpm-drain.c: fix initialization of nbthreads as well as size reporting (Dimitar) * ns/Cns_access.man: added "dangling symbolic link" as reason for ENOENT * dpm/Imakefile, dpm/dpm-drain.c, dpm/dpm_replicate.c: add option to dpm-drain to transfer multiple files at same time (bug #61037) Increase performance of dpm-drain by using RFIO instead of gridFTP (bug #60109) * srmv2.2/srmv2_dirreq.c: srm2.2 srmLs (SRM_TOO_MANY_RESULTS and application of count limit) (bug #46961) * rpm/DPM-mysql.spec, rpm/DPM-oracle.spec, rpm/DPM-postgres.spec, rpm/LFC-mysql.spec, rpm/LFC-oracle.spec, rpm/LFC-postgres.spec: package arguspoll * security/Csec_plugin_GSS.c: srmv1 and srmv2.2 segfaults while security scan (bug #77984) * config/site.def, configure, ns/Imakefile, ns/nsarguspoll.c: argus 1.3 interface * rpm/Makefile, rpm/lcg-dm-common.spec: voms packages do not have the same name in gLite and EMI * dpm/poolmgr.c: avoid crash introduced by dynamic number of threads feature when no pool exists yet and an addpool is done * config/site.def, configure, dpm/Imakefile, ns/Imakefile.lfc: first attempt to build the Python 2.6 interfaces for EMI * dpm/dpm.man, dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, dpm/dpm.scripts.postgresql, dpm/dpm.sysconfig.mysql, dpm/dpm.sysconfig.oracle, dpm/dpm.sysconfig.postgresql, dpm/dpm_main.c, dpm/dpm_proclreq.c, dpm/poolmgr.c, srmv2.2/srmv2.2.man, srmv2.2/srmv2.2.scripts.mysql, srmv2.2/srmv2.2.scripts.oracle, srmv2.2/srmv2.2.scripts.postgresql, srmv2.2/srmv2.2.sysconfig.mysql, srmv2.2/srmv2.2.sysconfig.oracle, srmv2.2/srmv2.2.sysconfig.postgresql, srmv2.2/srmv2.c: Allow to define the number of threads for DPM and SRM servers at startup time (bug #77655) * srmv2.2/srmv2.2.scripts.postgresql: remove NB_THREADS * dicomcopy/dicomcopyd.scripts.mysql, dicomcopy/dicomcopyd.scripts.oracle, dicomcopy/dicomcopyd.scripts.postgresql, dli/lfc-dli.scripts, dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, dpmcopy/dpmcopyd.scripts.mysql, dpmcopy/dpmcopyd.scripts.oracle, dpmcopy/dpmcopyd.scripts.postgresql, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/dpnsdaemon.scripts.postgresql, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, ns/lfcdaemon.scripts.postgresql, rfio/rfiod.scripts, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv1/srmv1.scripts.postgresql, srmv2.2/srmv2.2.scripts.mysql, srmv2.2/srmv2.2.scripts.oracle, srmv2.2/srmv2.2.scripts.postgresql, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle, srmv2/srmv2.scripts.postgresql: fix typo (extra parenthesis) * dpm/Imakefile: remove new dpm-drain rules * dicomcopy/dicomcopyd.man: do not document /opt/lcg as prefix for libdpm_dicom.so * dli/Imakefile: use PREFIX instead of hardcoded /opt/lcg * dicomcopy/Imakefile, dicomcopy/dicomcopyd.scripts.mysql, dicomcopy/dicomcopyd.scripts.oracle, dicomcopy/dicomcopyd.scripts.postgresql, dli/lfc-dli.scripts, dpm/Imakefile, dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, dpm/dpm.scripts.postgresql, dpmcopy/Imakefile, dpmcopy/dpmcopyd.scripts.mysql, dpmcopy/dpmcopyd.scripts.oracle, dpmcopy/dpmcopyd.scripts.postgresql, ns/Imakefile.dpns, ns/Imakefile.lfc, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/dpnsdaemon.scripts.postgresql, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, ns/lfcdaemon.scripts.postgresql, rfio/rfiod.scripts, srmv1/Imakefile, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv1/srmv1.scripts.postgresql, srmv2.2/Imakefile, srmv2.2/srmv2.2.scripts.mysql, srmv2.2/srmv2.2.scripts.oracle, srmv2.2/srmv2.2.scripts.postgresql, srmv2/Imakefile, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle, srmv2/srmv2.scripts.postgresql: use PREFIX instead of hardcoded /opt/lcg * scripts/proc-init-cern-afs: use Oracle 10.2.0.4 * rpm/DPM-client.spec, rpm/DPM-dicom.spec, rpm/DPM-interfaces-py25.spec, rpm/DPM-interfaces-py26.spec, rpm/DPM-mysql.spec, rpm/DPM-oracle.spec, rpm/DPM-postgres.spec, rpm/LFC-client.spec, rpm/LFC-interfaces-py25.spec, rpm/LFC-interfaces-py26.spec, rpm/LFC-mysql.spec, rpm/LFC-oracle.spec, rpm/LFC-postgres.spec, rpm/Makefile, rpm/lcg-dm-common.spec: set default Prefix to /opt/lcg for gLite and /usr for EMI * configure: accept --prefix option set /usr as default prefix for EMI * solaris/prototype.dpmclient: add rfio_rcp man page * dpm/dpm_util.c: suppress compilation error on Solaris * dpmcopy/Imakefile, srmv1/Imakefile, srmv2.2/Imakefile, srmv2/Imakefile: fix cgsi library name for EMI * dli/Imakefile: use SOAPLIB also for the client * configure: make /usr the default GsoapLocation for EMI * dli/Imakefile: first modifications to be able to build for gLite and EMI * rpm/lcg-dm-common.spec: library names have no flavour in EMI * config/site.def, configure: 2nd attempt to set /usr as default GlobusLocation and VomsLocation for EMI * config/site.def: set /usr as default GlobusLocation and VomsLocation for EMI * dli/Imakefile: VOMS is not used * config/site.def, configure, dicomcopy/Imakefile, dpm/Imakefile, dpmcopy/Imakefile, ns/Imakefile, security/Imakefile, srmv1/Imakefile, srmv2.2/Imakefile, srmv2/Imakefile: first modifications to be able to build for gLite and EMI * dpm/dpm2_python.man, ns/lfc2_python.man: suppress listreplica and listlinks which are not part of the python module * ns/Cns_delcomment.man, ns/Cns_getcomment.man, ns/Cns_setcomment.man: EPERM is never returned by this method * ns/Cns_closedir.man, ns/Cns_readdir.man: cannot return SENOSHOST as working on an established connection * ns/Cns_creatg.man: EFAULT can only occur if path is NULL * dli/Imakefile: no need for GLOBUS * rfio/rfio_calls.c: fix rfio_rcp to avoid "Permission denied" when executed by superuser * rpm/DPM-client.spec, rpm/DPM-mysql.spec: add rfio_rcp man pages * dpm/dpm-ping.c: set retry count to 0 * h/Cns_server.h, ns/Cns_libpq_ifce.c, ns/Cns_main.c, ns/Cns_mysql_ifce.c, ns/Cns_oracle_ifce.pc: retrial for root requests after db reconnection (bug #75064) 2010-11-05 12:51 baud - Before 1.8.0-1: * CHANGES: 1.8.0-1 tag * ns/Cns_procreq.c: suppress warnings at compile time for unused variables * ns/Cns_procreq.c: fix ACL when using lchown * dpm/dpm-shutdown.c: set retry count to 0 to avoid init script hang when pid file is present and daemon is not running * CHANGES: add entry about bug 49997 * VERSION: 1.8.0.1 * dli/dlilogit.c, dpm/dpmlogit.c, ns/nslogit.c, srmv1/srmlogit.c, srmv2.2/srmlogit.c, srmv2/srmlogit.c: add milliseconds to timestamps for better performance debugging * ns/Cns_getidmap.c: fix memory leak (senbuf) * scripts/upgrades/lfc-db-210-to-300: LFC 2.1.0 not supported any more * rpm/DPM-oracle.spec, rpm/LFC-mysql.spec, rpm/LFC-oracle.spec: Changes to the dpm/lfc mysql and oracle spec files to reflect changes regarding db upgrade scripts. * CHANGES-long: 1.8.0-0 * CHANGES: 1.8.0 tag * common/trace.c, ns/Cns_getidmap.c: suppress warnings at compile time * scripts/upgrades/Common.pm, scripts/upgrades/cns-db-300-to-310, scripts/upgrades/dpm-db-300-to-310, scripts/upgrades/dpm-db-310-to-320, scripts/upgrades/lfc-db-210-to-300: The connection must be explicitly closed * rpm/DPM-mysql.spec: update dpm-mysql spec file to reflect move from sql upgrade scripts to perl modules. * scripts/upgrades/Common.pm, scripts/upgrades/README, scripts/upgrades/cns-db-300-to-310, scripts/upgrades/cns-mysql-300-to-310.sql, scripts/upgrades/cns-oracle-300-to-310.sql, scripts/upgrades/dpm-db-300-to-310, scripts/upgrades/dpm-db-310-to-320, scripts/upgrades/dpm-mysql-300-to-310.sql, scripts/upgrades/dpm-mysql-310-to-320.sql, scripts/upgrades/dpm-oracle-300-to-310.sql, scripts/upgrades/dpm-oracle-310-to-320.sql, scripts/upgrades/lfc-db-210-to-300, scripts/upgrades/lfc-mysql-210-to-300.sql, scripts/upgrades/lfc-oracle-210-to-300.sql: Refactorized * rpm/DPM-mysql.spec: added new scripts and scheme for db upgrades * rpm/DPM-client.spec, rpm/DPM-mysql.spec, rpm/LFC-client.spec, rpm/LFC-mysql.spec: Please make symlinks within python-dpm relavtive (bug #73077) * rpm/DPM-mysql.spec, rpm/DPM-oracle.spec, rpm/LFC-mysql.spec, rpm/LFC-oracle.spec: add cns_db migration scripts to the list of packaged files * ns/Cns_delfilesbyguid.c, ns/Cns_delfilesbyname.c, ns/Cns_delreplicas.c, ns/Cns_delreplicasbysfn.c, ns/Cns_getreplicas.c, ns/Cns_getreplicasl.c, ns/Cns_getreplicass.c, ns/Cns_registerfiles.c: free dynamically allocated sendbuf to avoid memory leak * ns/Cns_getidmap.c: allocate dynamically sendbuf to accomodate for larger requests * dpm/dpm-listspaces: more fixes to avoid negative values * ns/Cns_procreq.c: add detailed error message "GUID mismatch" * ns/Cns_listlinks.man, ns/Cns_listreplica.man, ns/Cns_registerfiles.man: add "GUID mismatch" as possible explanation for EINVAL * common/Cgroupsubr.c, dpm/dpm_libpq_ifce.c, dpm/dpm_main.c, dpm/dpm_mysql_ifce.c, dpm/dpm_oracle_ifce.pc, dpm/dpm_procreq.c, ns/Cns_procreq.c, srmv1/srmv1_procreq.c, srmv2.2/srmv2_dirreq.c, srmv2.2/srmv2_permreq.c, srmv2.2/srmv2_xferreq.c, srmv2/srmv2_xferreq.c: servers crash when client passes too many FQANs in the proxy (bug #72382) * h/Cns_api.h, ns/Cns_getreplicas.c, ns/Cns_getreplicas.man, ns/Cns_getreplicasl.c, ns/Cns_getreplicasl.man, ns/Cns_getreplicass.c, ns/Cns_getreplicass.man, ns/Cns_procreq.c, ns/send2nsd.c: Extra information (host, status) to be returned by lfc_getreplicas (bug #72361) * rfio/rfio_rcp.man: document SETIMEDOUT error code * rfio/rfio_calls.c: return SETIMEDOUT in case of timeout and uses mask passed by client * performance: removed wrongly added performance directory * performance: added directory for performance related files/scripts * rfio/rfiod.man: add option -L for log level * rfio/rfio_serv.c: add third party rfcp add option -L for log level * h/rfio_api.h, h/rfio_constants.h, rfio/Imakefile, rfio/error.c, rfio/rcp.c, rfio/rfio_calls.c, rfio/rfio_rcp.man, rfio/stream.c: add third party rfcp * common/trace.c: send trace to RFIO_TRACEFILE if this environment variable is set; same for COMMON_TRACEFILE * scripts/upgrades, scripts/upgrades/README, scripts/upgrades/cns-mysql-300-to-310.sql, scripts/upgrades/cns-oracle-300-to-310.sql, scripts/upgrades/dpm-mysql-300-to-310.sql, scripts/upgrades/dpm-mysql-310-to-320.sql, scripts/upgrades/dpm-oracle-300-to-310.sql, scripts/upgrades/dpm-oracle-310-to-320.sql, scripts/upgrades/lfc-mysql-210-to-300.sql, scripts/upgrades/lfc-oracle-210-to-300.sql: New folder 'upgrades' with the SQL upgrade queries * rfio/read.c, rfio/read64.c: return -1 instead of 0 if read count not always the same in readahead mode * rfio/lseek.c, rfio/lseek64.c: fix the case where how is SEEK_END and offset is negative (Dimitar) * rpm/DPM-interfaces-py26.spec, rpm/LFC-interfaces-py26.spec, rpm/Makefile: Updates for python26 bindings * rpm/DPM-dicom.spec, rpm/DPM-mysql.spec, rpm/DPM-oracle.spec, rpm/LFC-oracle.spec: fix the cleaning of DB migration scripts * VERSION: 1.8.0 * h/dpns_api.h, h/lfc_api.h: banning of users and groups (bug #43710) * rpm/DPM-client.spec, rpm/DPM-dicom.spec, rpm/DPM-mysql.spec, rpm/DPM-oracle.spec, rpm/DPM-postgres.spec, rpm/LFC-client.spec, rpm/LFC-mysql.spec, rpm/LFC-oracle.spec, rpm/LFC-postgres.spec: Change dependencies to 1.8.0 * rfio/rfio_callhandlers.c: get user_ca and pass it to getidmap * scripts/cns-db-300-to-310, scripts/cns-db-300-to-310/Common.pm, scripts/cns-db-300-to-310/README, scripts/cns-db-300-to-310/UpdateCnsDatabase.pm, scripts/cns-db-300-to-310/cns_db_300_to_310: add migration scripts for cns_db when going from version 3.0.0 to 3.1.0 * h/Cns_api.h, h/Cns_constants.h, h/Cns_struct.h: banning of users and groups (bug #43710) * ns/Cns-python_typemaps.i, ns/Cns.i, ns/Cns_getgrpmap.c, ns/Cns_getidmap.c, ns/Cns_getidmap.man, ns/Cns_getusrmap.c, ns/Cns_libpq_ifce.c, ns/Cns_main.c, ns/Cns_modifygrpmap.c, ns/Cns_modifygrpmap.man, ns/Cns_modifyusrmap.c, ns/Cns_modifyusrmap.man, ns/Cns_mysql_ifce.c, ns/Cns_mysql_tbl.sql, ns/Cns_oracle_ifce.pc, ns/Cns_oracle_tbl.sql, ns/Cns_postgresql_tbl.sql, ns/Cns_procreq.c, ns/nslistgrpmap.c, ns/nslistusrmap.c, ns/nsmodifygrpmap.c, ns/nsmodifygrpmap.man, ns/nsmodifyusrmap.c, ns/nsmodifyusrmap.man, ns/send2nsd.c, ns/sendrep.c: banning of users and groups (bug #43710) * srmv2.2/srm_util.c: get user_ca and pass it to getidmap * srmv2/srm_util.c: get user_ca and pass it to getidmap * srmv1/srm_util.c: get user_ca and pass it to getidmap * dpm/dpm_main.c: get user_ca and pass it to getidmap * dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, dpm/dpm.scripts.postgresql: use finger to determine home directory only when starting service (bug #69716) * dpm/dpm-drain.c, dpm/dpm_oracle_ifce.pc, dpm/dpm_procreq.c: fix tabulation * h/Csec_api.h, h/Csec_common.h, security/Csec_api.c, security/Csec_api.man, security/Csec_plugin_GSS.c: add code to get user_ca * security/Csec_protocol_policy.c: fix typo in error message * dicomcopy/dicomcopyd.scripts.mysql, dicomcopy/dicomcopyd.scripts.oracle, dicomcopy/dicomcopyd.scripts.postgresql, dpmcopy/dpmcopyd.scripts.mysql, dpmcopy/dpmcopyd.scripts.oracle, dpmcopy/dpmcopyd.scripts.postgresql, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/dpnsdaemon.scripts.postgresql, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, ns/lfcdaemon.scripts.postgresql, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv1/srmv1.scripts.postgresql, srmv2.2/srmv2.2.scripts.mysql, srmv2.2/srmv2.2.scripts.oracle, srmv2.2/srmv2.2.scripts.postgresql, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle, srmv2/srmv2.scripts.postgresql: use finger to determine home directory only when starting service (bug #69716) * rfio/read.c, rfio/read64.c: fix crash when trying to read from an offset larger than filesize in preseek mode * rfio/lseek64.c: remove declaration of unused variable * ns/Cns_main.c: log timeouts while processing sessions or transactions * dicomcopy/dicomcopyd.scripts.mysql, dicomcopy/dicomcopyd.scripts.oracle, dicomcopy/dicomcopyd.scripts.postgresql, dli/lfc-dli.scripts, dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, dpm/dpm.scripts.postgresql, dpmcopy/dpmcopyd.scripts.mysql, dpmcopy/dpmcopyd.scripts.oracle, dpmcopy/dpmcopyd.scripts.postgresql, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/dpnsdaemon.scripts.postgresql, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, ns/lfcdaemon.scripts.postgresql, rfio/rfiod.scripts, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv1/srmv1.scripts.postgresql, srmv2.2/srmv2.2.scripts.mysql, srmv2.2/srmv2.2.scripts.oracle, srmv2.2/srmv2.2.scripts.postgresql, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle, srmv2/srmv2.scripts.postgresql: remove bashisms in LFC/DPM init scripts (bug #68430) 2010-10-08 08:33 baud - Before 1.8.0-0: * CHANGES: 1.8.0 tag * common/trace.c, ns/Cns_getidmap.c: suppress warnings at compile time * scripts/upgrades/Common.pm, scripts/upgrades/cns-db-300-to-310, scripts/upgrades/dpm-db-300-to-310, scripts/upgrades/dpm-db-310-to-320, scripts/upgrades/lfc-db-210-to-300: The connection must be explicitly closed * rpm/DPM-mysql.spec: update dpm-mysql spec file to reflect move from sql upgrade scripts to perl modules. * scripts/upgrades/Common.pm, scripts/upgrades/README, scripts/upgrades/cns-db-300-to-310, scripts/upgrades/cns-mysql-300-to-310.sql, scripts/upgrades/cns-oracle-300-to-310.sql, scripts/upgrades/dpm-db-300-to-310, scripts/upgrades/dpm-db-310-to-320, scripts/upgrades/dpm-mysql-300-to-310.sql, scripts/upgrades/dpm-mysql-310-to-320.sql, scripts/upgrades/dpm-oracle-300-to-310.sql, scripts/upgrades/dpm-oracle-310-to-320.sql, scripts/upgrades/lfc-db-210-to-300, scripts/upgrades/lfc-mysql-210-to-300.sql, scripts/upgrades/lfc-oracle-210-to-300.sql: Refactorized * rpm/DPM-mysql.spec: added new scripts and scheme for db upgrades * rpm/DPM-client.spec, rpm/DPM-mysql.spec, rpm/LFC-client.spec, rpm/LFC-mysql.spec: Please make symlinks within python-dpm relavtive (bug #73077) * rpm/DPM-mysql.spec, rpm/DPM-oracle.spec, rpm/LFC-mysql.spec, rpm/LFC-oracle.spec: add cns_db migration scripts to the list of packaged files * ns/Cns_delfilesbyguid.c, ns/Cns_delfilesbyname.c, ns/Cns_delreplicas.c, ns/Cns_delreplicasbysfn.c, ns/Cns_getreplicas.c, ns/Cns_getreplicasl.c, ns/Cns_getreplicass.c, ns/Cns_registerfiles.c: free dynamically allocated sendbuf to avoid memory leak * ns/Cns_getidmap.c: allocate dynamically sendbuf to accomodate for larger requests * dpm/dpm-listspaces: more fixes to avoid negative values * ns/Cns_procreq.c: add detailed error message "GUID mismatch" * ns/Cns_listlinks.man, ns/Cns_listreplica.man, ns/Cns_registerfiles.man: add "GUID mismatch" as possible explanation for EINVAL * common/Cgroupsubr.c, dpm/dpm_libpq_ifce.c, dpm/dpm_main.c, dpm/dpm_mysql_ifce.c, dpm/dpm_oracle_ifce.pc, dpm/dpm_procreq.c, ns/Cns_procreq.c, srmv1/srmv1_procreq.c, srmv2.2/srmv2_dirreq.c, srmv2.2/srmv2_permreq.c, srmv2.2/srmv2_xferreq.c, srmv2/srmv2_xferreq.c: servers crash when client passes too many FQANs in the proxy (bug #72382) * h/Cns_api.h, ns/Cns_getreplicas.c, ns/Cns_getreplicas.man, ns/Cns_getreplicasl.c, ns/Cns_getreplicasl.man, ns/Cns_getreplicass.c, ns/Cns_getreplicass.man, ns/Cns_procreq.c, ns/send2nsd.c: Extra information (host, status) to be returned by lfc_getreplicas (bug #72361) * rfio/rfio_rcp.man: document SETIMEDOUT error code * rfio/rfio_calls.c: return SETIMEDOUT in case of timeout and uses mask passed by client * performance: removed wrongly added performance directory * performance: added directory for performance related files/scripts * rfio/rfiod.man: add option -L for log level * rfio/rfio_serv.c: add third party rfcp add option -L for log level * h/rfio_api.h, h/rfio_constants.h, rfio/Imakefile, rfio/error.c, rfio/rcp.c, rfio/rfio_calls.c, rfio/rfio_rcp.man, rfio/stream.c: add third party rfcp * common/trace.c: send trace to RFIO_TRACEFILE if this environment variable is set; same for COMMON_TRACEFILE * scripts/upgrades, scripts/upgrades/README, scripts/upgrades/cns-mysql-300-to-310.sql, scripts/upgrades/cns-oracle-300-to-310.sql, scripts/upgrades/dpm-mysql-300-to-310.sql, scripts/upgrades/dpm-mysql-310-to-320.sql, scripts/upgrades/dpm-oracle-300-to-310.sql, scripts/upgrades/dpm-oracle-310-to-320.sql, scripts/upgrades/lfc-mysql-210-to-300.sql, scripts/upgrades/lfc-oracle-210-to-300.sql: New folder 'upgrades' with the SQL upgrade queries * rfio/read.c, rfio/read64.c: return -1 instead of 0 if read count not always the same in readahead mode * rfio/lseek.c, rfio/lseek64.c: fix the case where how is SEEK_END and offset is negative (Dimitar) * rpm/DPM-interfaces-py26.spec, rpm/LFC-interfaces-py26.spec, rpm/Makefile: Updates for python26 bindings * rpm/DPM-dicom.spec, rpm/DPM-mysql.spec, rpm/DPM-oracle.spec, rpm/LFC-oracle.spec: fix the cleaning of DB migration scripts * VERSION: 1.8.0 * h/dpns_api.h, h/lfc_api.h: banning of users and groups (bug #43710) * rpm/DPM-client.spec, rpm/DPM-dicom.spec, rpm/DPM-mysql.spec, rpm/DPM-oracle.spec, rpm/DPM-postgres.spec, rpm/LFC-client.spec, rpm/LFC-mysql.spec, rpm/LFC-oracle.spec, rpm/LFC-postgres.spec: Change dependencies to 1.8.0 * rfio/rfio_callhandlers.c: get user_ca and pass it to getidmap * scripts/cns-db-300-to-310, scripts/cns-db-300-to-310/Common.pm, scripts/cns-db-300-to-310/README, scripts/cns-db-300-to-310/UpdateCnsDatabase.pm, scripts/cns-db-300-to-310/cns_db_300_to_310: add migration scripts for cns_db when going from version 3.0.0 to 3.1.0 * h/Cns_api.h, h/Cns_constants.h, h/Cns_struct.h: banning of users and groups (bug #43710) * ns/Cns-python_typemaps.i, ns/Cns.i, ns/Cns_getgrpmap.c, ns/Cns_getidmap.c, ns/Cns_getidmap.man, ns/Cns_getusrmap.c, ns/Cns_libpq_ifce.c, ns/Cns_main.c, ns/Cns_modifygrpmap.c, ns/Cns_modifygrpmap.man, ns/Cns_modifyusrmap.c, ns/Cns_modifyusrmap.man, ns/Cns_mysql_ifce.c, ns/Cns_mysql_tbl.sql, ns/Cns_oracle_ifce.pc, ns/Cns_oracle_tbl.sql, ns/Cns_postgresql_tbl.sql, ns/Cns_procreq.c, ns/nslistgrpmap.c, ns/nslistusrmap.c, ns/nsmodifygrpmap.c, ns/nsmodifygrpmap.man, ns/nsmodifyusrmap.c, ns/nsmodifyusrmap.man, ns/send2nsd.c, ns/sendrep.c: banning of users and groups (bug #43710) * srmv2.2/srm_util.c: get user_ca and pass it to getidmap * srmv2/srm_util.c: get user_ca and pass it to getidmap * srmv1/srm_util.c: get user_ca and pass it to getidmap * dpm/dpm_main.c: get user_ca and pass it to getidmap * dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, dpm/dpm.scripts.postgresql: use finger to determine home directory only when starting service (bug #69716) * dpm/dpm-drain.c, dpm/dpm_oracle_ifce.pc, dpm/dpm_procreq.c: fix tabulation * h/Csec_api.h, h/Csec_common.h, security/Csec_api.c, security/Csec_api.man, security/Csec_plugin_GSS.c: add code to get user_ca * security/Csec_protocol_policy.c: fix typo in error message * dicomcopy/dicomcopyd.scripts.mysql, dicomcopy/dicomcopyd.scripts.oracle, dicomcopy/dicomcopyd.scripts.postgresql, dpmcopy/dpmcopyd.scripts.mysql, dpmcopy/dpmcopyd.scripts.oracle, dpmcopy/dpmcopyd.scripts.postgresql, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/dpnsdaemon.scripts.postgresql, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, ns/lfcdaemon.scripts.postgresql, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv1/srmv1.scripts.postgresql, srmv2.2/srmv2.2.scripts.mysql, srmv2.2/srmv2.2.scripts.oracle, srmv2.2/srmv2.2.scripts.postgresql, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle, srmv2/srmv2.scripts.postgresql: use finger to determine home directory only when starting service (bug #69716) * rfio/read.c, rfio/read64.c: fix crash when trying to read from an offset larger than filesize in preseek mode * rfio/lseek64.c: remove declaration of unused variable * ns/Cns_main.c: log timeouts while processing sessions or transactions * dicomcopy/dicomcopyd.scripts.mysql, dicomcopy/dicomcopyd.scripts.oracle, dicomcopy/dicomcopyd.scripts.postgresql, dli/lfc-dli.scripts, dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, dpm/dpm.scripts.postgresql, dpmcopy/dpmcopyd.scripts.mysql, dpmcopy/dpmcopyd.scripts.oracle, dpmcopy/dpmcopyd.scripts.postgresql, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/dpnsdaemon.scripts.postgresql, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, ns/lfcdaemon.scripts.postgresql, rfio/rfiod.scripts, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv1/srmv1.scripts.postgresql, srmv2.2/srmv2.2.scripts.mysql, srmv2.2/srmv2.2.scripts.oracle, srmv2.2/srmv2.2.scripts.postgresql, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle, srmv2/srmv2.scripts.postgresql: remove bashisms in LFC/DPM init scripts (bug #68430) 2010-06-01 17:28 baud - Before 1.7.4-7: * CHANGES, VERSION: 1.7.4-7 * rpm/DPM-interfaces-py25.spec, rpm/LFC-interfaces-py25.spec: use the new packaging name convention * dpm/Imakefile: avoid make warnings when configured --with-client-only * ns/Imakefile.dpns, ns/Imakefile.lfc: avoid make warnings when configured --with-client-only * ns/nsdelcomment.c: include to get proto for exit function * configure: to support gsoap versions > 2.7.15 (bug #67796) * rfio/read64.c: lseek error after hitting eof in pre-read mode * srmv2.2/srmv2_spacereq.c: avoid daemon crash when permission denied on a GetSpaceMetadata 2010-04-29 16:40 baud - Before 1.7.4-6: * CHANGES, VERSION: 1.7.4-6 * dpm/dpm-drain.c, dpm/dpm_copyfile.c, h/dpm_api.h: correct rollback of the dpm-drain multi-threaded feature * dpm/dpm-qryconf.man: document that '-' is also a possible value for the space type * rfio/rfio_call64.c, rfio/rfio_calls.c: better parameter logging in case of error * ns/Cns_getreplicass.c, ns/Cns_getreplicass.man: SURLs bulk lookup in LFC (bug #60796) * debian/templates/liblfc-dev.install, h/Cns.h, h/Cns_api.h, h/lfc_api.h, ns/Cns.i, ns/Cns_main.c, ns/Cns_procreq.c, ns/Imakefile.lfc, ns/lfc.i, ns/lfc2_python.man, rpm/LFC-client.spec, rpm/LFC-mysql.spec, solaris/prototype.lfcclient: SURLs bulk lookup in LFC (bug #60796) 2010-04-20 14:05 rocha - Before 1.7.4-5: * VERSION: 1.7.4-5 * CHANGES: 1.7.4-5 * dpm/dpm-drain.man: remove dpm-drain multi-threaded feature because of hangs discovered at LAL * dpm/dpm_oracle_ifce.pc, ns/Cns_oracle_ifce.pc: number of DB connections can exceed the number of configured threads because of a missing ROLLBACK WORK RELEASE in closedb (BNL LFC problem) * ns/Cns_procreq.c: fix rewinddir method broken by LFC/DPM 1.7.3 (bug #65514) * rfio/rfio_call64.c, rfio/rfio_calls.c: fix rfcp hang * common/Cgetopt.man, common/Cglobals.man, common/Cmutex.man, common/Cpool.man, common/Csched.man, ns/Cns_access.man, ns/Cns_accessr.man, ns/Cns_startsess.man, ns/Cns_starttrans.man, rfio/rfio_access.man, rfio/rfio_readdir.man, security/Csec_api.man: Man page typos and glitches (bug #65298) * dpm/Imakefile: Fix typo (bug #65297) * dpm/dpm-rmpool.c, dpm/dpm_procreq.c, dpm/dpm_rmpool.man: DPM should not permit removal of pool if it contains a reserved space (GGUS #56819) * debian/rules, rpm/Makefile, solaris/Makefile: exclude .svn directories from tar file (instead of CVS) * ns/Cns_procreq.c: improve authorization checks in processing of setrstatus method * dpm/dpm_main.c, dpm/dpm_proclreq.c, dpm/dpm_procreq.c: report RFIO detailed error message in abortfile, putdone and rm * dpm/dpm_proclreq.c: store RFIO detailed error message in DPM request DB allowing the DPM client or the SRM to give more precise error messages * h/osdep.h: define LLONG_MAX if not already defined * dpm/dpm_proclreq.c, dpm/dpm_procreq.c, srmv1/srmv1_procreq.c, srmv2.2/srmv2_xferreq.c, srmv2/srmv2_xferreq.c: do not store -1 in u_signed64 to avoid message "dpm_update_pfr_entry: UPDATE error: ERROR: integer out of range" 2010-03-10 17:49 rocha - Before 1.7.4-4: * srmv2.2/srmv2.c: fix typo in service name * CHANGES, VERSION: 1.7.4-4 tag * dpm/dpm-listspaces: fix free space reporting (GGUS #54818 and GGUS #56150) * common/Cinitdaemon.c, common/Cpool.c, dpm/dpm_register.c: suppress calls to "exit" in library routines 2010-03-08 15:17 rocha - Before 1.7.4-3: * CHANGES, VERSION: 1.7.4-3 tag * rpm/DPM-client.spec, rpm/DPM-dicom.spec, rpm/DPM-mysql.spec, rpm/DPM-oracle.spec, rpm/DPM-postgres.spec, rpm/LFC-client.spec, rpm/LFC-mysql.spec, rpm/LFC-oracle.spec, rpm/LFC-postgres.spec, rpm/lcg-dm-common.spec: split shared libraries from CLIs to allow coexistence of 32bits and 64bits libraries (bug #56619) * debian/templates/liblcgdm1.postinst: Added placeholders for prefix and libdir * debian/control, debian/rules, debian/templates/libdpm1.postinst, debian/templates/liblcgdm1.install, debian/templates/liblcgdm1.postinst, debian/templates/liblfc1.postinst: Updated liblcgdm1 postinstall to take arch and libdir into account when handling ldconfig. Added explicit dependency on python/perl (instead of using depends, we can easily support py2.3 for example). * h/Cns_server.h, ns/Cns_acl.c, ns/Cns_procreq.c: give more precise error message in setacl (GGUS #56192) * debian/changelog, debian/control, debian/copyright, debian/rules, debian/templates/dpm-interfaces.install, debian/templates/lfc-interfaces.install, debian/templates/libdpm-dev.install, debian/templates/libdpm-perl.install, debian/templates/libdpm.install, debian/templates/libdpm.postinst, debian/templates/libdpm1.install, debian/templates/libdpm1.postinst, debian/templates/liblcg-dm-common-dev.install, debian/templates/liblcg-dm-common.install, debian/templates/liblcg-dm-common.postinst, debian/templates/liblcgdm-dev.install, debian/templates/liblcgdm1.install, debian/templates/liblcgdm1.postinst, debian/templates/liblfc-dev.install, debian/templates/liblfc-perl.install, debian/templates/liblfc.install, debian/templates/liblfc.postinst, debian/templates/liblfc1.install, debian/templates/liblfc1.postinst, debian/templates/python-dpm.install, debian/templates/python-lfc.install: Split of debian packages into a better structure - client, lib, and lib*dev for both DPM and LFC, and the old interfaces package split into python-dpm/lfc and libdpm/lfc-perl. * LICENSE: add information about EGEE project * scripts/change-dpm-name/README: change twiki server from uimon to twiki 2010-02-26 17:13 baud - Before 1.7.4-2: * dpm/dpm-listspaces: Suppress publishing of access protocol 'gsirfio' when --legacy is not specified * CHANGES: 1.7.4-2 * debian/templates/libdpm.install, debian/templates/liblfc.install: Added missing man pages on dpm and lfc dev packages * ns/nssetcomment.c: include to get proto for exit function * debian/control, debian/rules, debian/templates/dpm-client.install, debian/templates/lfc-client.install, debian/templates/libdpm-dev.install, debian/templates/libdpm.install, debian/templates/liblcg-dm-common-dev.install, debian/templates/liblcg-dm-common.install, debian/templates/liblfc-dev.install, debian/templates/liblfc.install: Split liblcg-dm-common into 2 packages (adding a new -dev one). Moved API man pages to library packages instead of dev packages. Moved client man pages from the library package to the client package. * h/Cns.h, h/Cns_constants.h, h/dpm.h, h/dpm_constants.h: move definition of DEFAULT_RETRYCNT and DEFAULT_CONNTIMEOUT to avoid warnings when generating Python and Perl interfaces * dicomcopy/Imakefile, dpm/Imakefile, dpmcopy/Imakefile, ns/Imakefile, srmv1/Imakefile, srmv2.2/Imakefile, srmv2/Imakefile: allow to set Postgres header files location with POSINC variable * debian/rules: Fixed the build target (was duplicated), added the generated source tarball to the list of clean items. * VERSION: 1.7.4-2 * h/dpm_constants.h: add timeouts in dpm clients and allow to contol number of retries * dpm/dpm_abortfiles.c, dpm/dpm_abortreq.c, dpm/dpm_addfs.c, dpm/dpm_addpool.c, dpm/dpm_copy.c, dpm/dpm_delreplica.c, dpm/dpm_extendfilelife.c, dpm/dpm_get.c, dpm/dpm_getpoolfs.c, dpm/dpm_getpools.c, dpm/dpm_getprotocols.c, dpm/dpm_getreqid.c, dpm/dpm_getreqsummary.c, dpm/dpm_getspacemd.c, dpm/dpm_getspacetoken.c, dpm/dpm_getstatus_copyreq.c, dpm/dpm_getstatus_getreq.c, dpm/dpm_getstatus_putreq.c, dpm/dpm_inc_reqctr.c, dpm/dpm_modifyfs.c, dpm/dpm_modifypool.c, dpm/dpm_put.c, dpm/dpm_putdone.c, dpm/dpm_releasespace.c, dpm/dpm_relfiles.c, dpm/dpm_reservespace.c, dpm/dpm_rm.c, dpm/dpm_rmfs.c, dpm/dpm_rmpool.c, dpm/dpm_updatefilestatus.c, dpm/dpm_updatespace.c, dpm/send2dpm.c: add timeouts in dpm clients and allow to contol number of retries * dicomcopy/Imakefile: define DEPLIB * ns/Imakefile.dpns, ns/Imakefile.lfc: define DEPLIB * dpm/Imakefile: define DEPLIB * srmv2.2/srmv2_permreq.c: fix srmSetPermissions when changing groupowner (GGUS 50779) It has been agreed to pass '-' as groupId in this case. * solaris/prototype.lcgdmcmn: Fix for bug 56630 (change man page location) * solaris/prototype.lcgdmcmn: distribute header files and man pages with lcgdm library * debian/templates/dpm-interfaces.install: add missing man page dpm2_python * dicomcopy/Imakefile, dli/Imakefile, dpm/Imakefile, dpmcopy/Imakefile, ns/Imakefile.dpns, ns/Imakefile.lfc, rfio/Imakefile, srmv1/Imakefile, srmv2.2/Imakefile, srmv2/Imakefile: set daemon mode to 0755 (fix bug 57531) * srmv1/srmv1.c, srmv2.2/srmv2.c, srmv2/srmv2.c: Suppress the need for grid-mapfile and gridmapdir on head node. This fixes the bug 33899. * dicomcopy/dicomcopyd.scripts.mysql, dicomcopy/dicomcopyd.scripts.oracle, dicomcopy/dicomcopyd.scripts.postgresql, dli/lfc-dli.scripts, dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, dpm/dpm.scripts.postgresql, dpmcopy/dpmcopyd.scripts.mysql, dpmcopy/dpmcopyd.scripts.oracle, dpmcopy/dpmcopyd.scripts.postgresql, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/dpnsdaemon.scripts.postgresql, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, ns/lfcdaemon.scripts.postgresql, rfio/rfiod.scripts, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv1/srmv1.scripts.postgresql, srmv2.2/srmv2.2.scripts.mysql, srmv2.2/srmv2.2.scripts.oracle, srmv2.2/srmv2.2.scripts.postgresql, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle, srmv2/srmv2.scripts.postgresql: add support for Debian (bug 57532) fix restart option, it was failing if the daemon was already stopped (bug 55339) * debian/templates/libdpm-dev.install, rpm/DPM-client.spec, rpm/DPM-mysql.spec, solaris/prototype.dpmclient: fix typo in man page filename * debian/templates/libdpm-dev.install, rpm/DPM-client.spec, rpm/DPM-mysql.spec, solaris/prototype.dpmclient: add rfio_setbufsize man page * configure: test -e does not exist in Solaris Bourne shell * rfio/Imakefile: add rfio_setbufsize man page * rfio/open64.c, rfio/rfio_setbufsize.man, rfio/rfiosetopt.man, rfio/setopt.c: to allow setting of buffersize on client side (bug 56166) * rfio/rfio_call64.c, rfio/rfio_calls.c: more cleanup * rfio/checkkey.c, rfio/fio.c, rfio/open.c, rfio/parse.c, rfio/popen.c, rfio/preseek.c, rfio/rfchmod.c, rfio/rfcp.c, rfio/rfio_HsmIf.c, rfio/rfio_fcalls.c, rfio/rfio_serv.c, rfio/rfioacct.c, rfio/rfmkdir.c, rfio/rfrename.c, rfio/rfrm.c, rfio/rfstatfs.c, rfio/stream.c, rfio/stream64.c, rfio/switch_req.c, rfio/xyclose.c, rfio/xyopen.c, rfio/xyread.c, rfio/xywrite.c: just to update Revision and Date * h/rfcntl.h, h/rfio.h, h/rfio_api.h, h/rfio_constants.h, h/rfio_server.h: just to update Revision and Date * common/Imakefile: just to update Revision and Date * dpm/dpm-drain.man: document the --threads option and correct a few typos * common/Imakefile: suppress deprecated platforms * h/osdep.h: suppress deprecated platforms * h/Imakefile: reorder header file names * h/rfcntl.h, h/rfio.h, h/rfio_api.h, h/rfio_constants.h: RFIO code cleanup: remove old platforms like apollo, cray, ultrix, hpss, ibmesa and old CASTOR stager * rfio/Imakefile, rfio/checkkey.c, rfio/fio.c, rfio/open.c, rfio/parse.c, rfio/popen.c, rfio/preseek.c, rfio/rfchmod.c, rfio/rfcp.c, rfio/rfio_HsmIf.c, rfio/rfio_call64.c, rfio/rfio_calls.c, rfio/rfio_fcalls.c, rfio/rfio_serv.c, rfio/rfioacct.c, rfio/rfmkdir.c, rfio/rfrename.c, rfio/rfrm.c, rfio/rfstatfs.c, rfio/stream.c, rfio/stream64.c, rfio/switch_req.c, rfio/xyclose.c, rfio/xyopen.c, rfio/xyread.c, rfio/xywrite.c: RFIO code cleanup: remove old platforms like apollo, cray, ultrix, hpss, ibmesa and old CASTOR stager * h/rfio_server.h: To avoid redeclaration of constants and prototypes in several files * config/Imake.rules, config/site.def: do not format man pages with nroff by default (bugs 33692, 33693, 57533) * dpm/dpm_addpool.man, dpm/dpm_modifypool.man: document that '-' is an an acceptable value for space type in addpool and modifypool (bug 50760) * dpm/dpm-addpool.man, dpm/dpm-modifypool.man: document that '-' is an an acceptable value for space type in addpool and modifypool (bug 50760) * dpm/dpm_procreq.c: remove trailing slashes in filesystem names for addfs, modifyfs, rmfs (bugs 39279 and 58716) * rfio/rfdir.c, rfio/rfstat.c: do not lookup virtual ids with getpwuid/getgrgid in rfstat, rfdir (bug 48250) * dpm/dpm_procreq.c: forbid non superuser to shutdown the DPM daemon * config/Imake.rules: some commands can fail if issued under fakeroot (bug 57534) * dpmcopy/Imakefile: make sure that the archive library is cleaned as well (bug 57534) * dpm/Imakefile, ns/Imakefile.lfc: change targets to be able to use parallel make * rfio/Imakefile: make sure that the scripts are also cleaned from build directory (bug 57534) * rfio/Imakefile: split between client and server man pages (bug 57533) * dpm/dpm.man: document REQCLEAN configuration option for setting request retention period in DB * dpm/dpm2_python.man, dpm/dpm_python.man, ns/lfc2_python.man, ns/lfc_python.man: fix prototypes and examples in Python interfaces man pages * ns/nsentergrpmap.man, ns/nsenterusrmap.man, ns/nsmodifygrpmap.man, ns/nsmodifyusrmap.man, ns/nsrmgrpmap.man, ns/nsrmusrmap.man, rfio/rfio_fstat64.man: fix a few problems with man pages like section number or .so (bug 57533) * ns/Cns_oracle_ifce.pc: add processing for errors 12520 and 12541 * dpm/dpm_oracle_ifce.pc: fix cursor names and add processing for a few more Oracle error codes 2009-12-17 16:52 dhsmith - Before 1.7.4: * CHANGES, rfio/rfiod.scripts: rfiod init.d script change for bug 57229 * dpm/dpm_mysql_ifce.c: Use BETWEEN in SQL query, and initalise dblistpr * CHANGES, dpm/dpm-drain.c, dpm/dpm_replicate.c, h/dpm_api.h, h/dpm_constants.h, dpm/dpm_copyfile.c: Allow multithreaded operation of dpm-drain * CHANGES, dpm/dpm-python_typemaps.i, dpm/dpm.i, dpm/dpm2.i, ns/Cns.i, ns/lfc2.i, ns/lfc2thr.i: Fix for bug #60299, #55987 * project/e-c_LCG-DM-client.ini: Added Debian5 build instructions * debian/rules: Fixing bug#55139: should not use lib64 on Debian * CHANGES, config/site.def, debian/templates/dpm-interfaces.install, debian/templates/lfc-interfaces.install, debian/templates/libdpm-dev.install, debian/templates/liblcg-dm-common.install, debian/templates/liblfc-dev.install, rpm/DPM-client.spec, rpm/DPM-dicom.spec, rpm/DPM-mysql.spec, rpm/DPM-oracle.spec, rpm/DPM-postgres.spec, rpm/LFC-client.spec, rpm/LFC-mysql.spec, rpm/LFC-oracle.spec, rpm/LFC-postgres.spec, rpm/lcg-dm-common.spec, solaris/prototype.copymys, solaris/prototype.copyora, solaris/prototype.copypsql, solaris/prototype.dicommys, solaris/prototype.dicompsql, solaris/prototype.dpmclient, solaris/prototype.dpmdicommys, solaris/prototype.dpmdicompsql, solaris/prototype.dpmifce, solaris/prototype.dpmifce2, solaris/prototype.dpmmys, solaris/prototype.dpmora, solaris/prototype.dpmpsql, solaris/prototype.dpnsmys, solaris/prototype.dpnsora, solaris/prototype.dpnspsql, solaris/prototype.lcgdmcmn, solaris/prototype.lfcclient, solaris/prototype.lfcifce, solaris/prototype.lfcifce2, solaris/prototype.lfcmys, solaris/prototype.lfcora, solaris/prototype.lfcpsql, solaris/prototype.rfioserver, solaris/prototype.srmmys, solaris/prototype.srmora, solaris/prototype.srmpsql: Fix for bug 56630 (change man page location) * VERSION: Change version number * CHANGES, VERSION, dicomcopy/dicomcopy_mysql_ifce.c, dpm/dpm_libpq_ifce.c, dpm/dpm_main.c, dpm/dpm_mysql_ifce.c, dpm/dpm_oracle_ifce.pc, dpm/dpm_util.c, h/dpm_server.h, h/dpm_util.h: Periodic cleanup of old requests from dpm_db * h/Imakefile, rpm/lcg-dm-common.spec: Distributing the header files with the lcg-dm-common shared library. * CHANGES, common/Cnetdb.c: Do not add trailing dot on forward name lookup * CHANGES, dpm/dpm_proclreq.c, srmv2.2/srmv2_xferreq.c: Update error/message for dpm_get/srmCopy on a directory * CHANGES: Update changes file * project/e-c_LCG-DM-py25.ini: Change etics configuration template to use swig 1.3.31 for interface builds for python 2.5 * project/e-c_LCG-DM-py25.ini: Set etics configuration template to specify swig 1.3.31 for python 2.5 build * CHANGES, VERSION: Prepare for 1.7.2-6 on branch 1_7_2 * CHANGES, ns/Cns_procreq.c: Mirror fix for castor ns bug 56212 2009-09-04 10:34 dhsmith - Before 1.7.3: * CHANGES, VERSION: Prepare for version 1.7.3-1 * CHANGES, dpm/dpm_auth.c, h/Cns_api.h, h/dpm_api.h: Add dpm_client_resetAuthorizationId * CHANGES, security/Csec_api.c: Remove extra semicolon from var declartion that breaks strict ansi C compliance * CHANGES: Correct a bug comment * CHANGES: Add in comment for bug fixes for 50962, 51530 * CHANGES, dpm/dpm_util.c, h/dpm_util.h, srmv1/srmv1_procreq.c, srmv2/srmv2_dirreq.c, srmv2.2/srmv2_dirreq.c: Bug fix for 54848 * dli/Imakefile, dpm/Imakefile, dpmcopy/Imakefile, lib/Imakefile, ns/Imakefile, rfio/Imakefile, srmv1/Imakefile, srmv2/Imakefile, srmv2.2/Imakefile: Reverting the liblcgdm changes for static libraries. In other words, only liblcgdm.so would be split from liblfc.so and libdpm.so. * dicomcopy/Imakefile, dli/Imakefile, dpm/Imakefile, dpmcopy/Imakefile, h/Imakefile, lib/Imakefile, ns/Imakefile, rfio/Imakefile, rpm/lcg-dm-common.spec, shlib/Imakefile, srmv1/Imakefile, srmv2/Imakefile, srmv2.2/Imakefile: Created a new liblcgdm.so library by moving the objects of 'security' and 'common' out of libdpm.so and liblfc.so. * CHANGES, security/Csec_api.c: Ammend fix for old bug 19878 * CHANGES, ns/Cns_main.c, ns/Cns_procreq.c: Fix for bug #50397 * scripts/DPM-info-dynamic/: Makefile.rpm, VERSION, lcg-info-dynamic-dpm, lcg-info-dynamic-dpm.spec: obsoleted by dpm-listspaces * CHANGES: [no log message] * dpm/Imakefile, ns/Imakefile.lfc: Clarifying the usage of -D_GNU_SOURCE (bug#54542). * CHANGES, srmv2.2/srmv2_dirreq.c: fix for 53568 * LICENSE, debian/copyright, project/e-m_LCG-DM-client.ini, project/e-m_LCG-DM-oracle.ini, project/e-m_LCG-DM-py25.ini, project/e-m_LCG-DM.ini, rpm/DPM-client.spec, rpm/DPM-dicom.spec, rpm/DPM-interfaces-py25.spec, rpm/DPM-mysql.spec, rpm/DPM-oracle.spec, rpm/DPM-postgres.spec, rpm/LFC-client.spec, rpm/LFC-interfaces-py25.spec, rpm/LFC-mysql.spec, rpm/LFC-oracle.spec, rpm/LFC-postgres.spec, rpm/lcg-dm-common.spec: Changing the license from GPL to Apache-2.0, according to the EGEE/gLite project policy. Fixes bug#54542. * scripts/publish-to-web: proper cleanup * scripts/: filter-manpage-nroff.sh, publish-to-web: Updated scripts to publish the man pages to the web. * CHANGES, dpm/dpm_procreq.c, ns/Cns_acl.c: Fixes for savannah bugs 39280, 50818 * rpm/: DPM-mysql.spec, DPM-oracle.spec, DPM-postgres.spec, LFC-mysql.spec, LFC-oracle.spec, LFC-postgres.spec: SL 4.7 only has e2fsprogs 1.35, it is only SL 4.8, which will split it to e2fsprogs-libs and e2fsprogs, so reverting the dependency. * dpm/dpm-listspaces: spaces may come without a space description (Michel Jouvin) * dpm/dpm-listspaces: only static spaces are published in gip (Michel Jouvin) * dpm/dpm-listspaces: fixing #50962 (Michel Jouvin) * project/: e-c_LCG-DM-client.ini, e-c_LCG-DM-oracle.ini, e-c_LCG-DM-py25.ini: 'nocheckstyle = true' will switch off sloccount for all but one LCG-DM ETICS component to avoid double counting of lines. 2009-06-02 11:44 szamcsi - Before 1.7.2-5: * dpm/dpm.i, ns/Cns-python_typemaps.i, ns/lfc.i: Fix bug #50977: [LCG-DM] problem accessing string structure member with swig 1.3.29 (sl5) * project/e-c_LCG-DM-client.ini: final changes from Eamonn * project/e-c_LCG-DM.ini: Removed Debian specific build commands to avoid ETICS locking problems on SLC4/gLite R3.1. * CHANGES: fixing bug#50045 * rpm/: DPM-mysql.spec, DPM-oracle.spec, DPM-postgres.spec, LFC-mysql.spec, LFC-oracle.spec, LFC-postgres.spec: Added e2fsprogs-libs RPM dependency for libuuid.so. Exists on SLC 4.7 and SLC 5.3. 2009-04-23 16:54 dhsmith - Before 1.7.2-4: * config/site.def: add new varaible SwigLib * configure, dpm/Imakefile, ns/Imakefile.lfc: Fix SWIG_LIB variable 2009-04-22 10:16 dhsmith - Before 1.7.2-3: * CHANGES: Update changes * ns/: nschmod.c, nsmkdir.c: Bug fixes for savannah 49345 and ggus 48060 * project/: e-c_LCG-DM-client.ini, e-c_LCG-DM.ini: Debian build commands from Eamonn Kenny. * rpm/: DPM-client.spec, DPM-interfaces-py25.spec, DPM-mysql.spec, LFC-client.spec, LFC-interfaces-py25.spec, LFC-mysql.spec: Adjust DPM/LFC-interfaces(2)-py25 requirements and remove conflict with interfaces(2) * debian/rules: Avoiding considering the 'CVS' directory as a template, which needs to be instatiated. May need to be refactored to have an explicit check for 'CVS', if a template file is added without a dot in the name. * dpm/: dpm-listspaces, dpm-listspaces.man: Updated dpm-listspaces to 1.3.1-6 * CHANGES, dpm/dpm-listspaces, dpm/dpm-listspaces.man: fix for bug #49369 * CHANGES, VERSION, rpm/DPM-client.spec, rpm/DPM-mysql.spec, rpm/LFC-client.spec, rpm/LFC-mysql.spec: package symbolic links in interfaces rpm package rather than create during postscript * debian/: changelog, compat, control, copyright, rules, templates/dpm-client.install, templates/dpm-interfaces.install, templates/lfc-client.install, templates/lfc-interfaces.install, templates/libdpm-dev.install, templates/libdpm.install, templates/libdpm.postinst, templates/liblcg-dm-common.install, templates/liblcg-dm-common.postinst, templates/liblfc-dev.install, templates/liblfc.install, templates/liblfc.postinst: Initial draft of the Debian packaging: - still uses the 'lib64' directory, until our dependencies migrate - 'changelog' shall be updated from 'CHANGES' automatically - client only yet * configure, config/site.def: New 'configure' option: --libdir= Default is the RedHat behaviour, i.e. 'lib' on i386, and 'lib64' on x86_64. * VERSION: Update version * CHANGES, dli/Imakefile, rpm/LFC-mysql.spec, rpm/LFC-oracle.spec, rpm/LFC-postgres.spec: Removed dli dependency on cgsi for the LFC 2009-04-06 10:41 dhsmith - Before 1.7.2: * CHANGES, VERSION, dpm/dpm.i, h/Cns.h, h/Cns_api.h, h/dpns_api.h, h/lfc_api.h, ns/Cns-python_typemaps.i, ns/Cns.i, ns/Cns_delreplicasbysfn.c, ns/Cns_delreplicasbysfn.man, ns/Cns_main.c, ns/Cns_procreq.c, ns/Cns_registerfiles.c, ns/Cns_registerfiles.man, ns/Imakefile.dpns, ns/Imakefile.lfc, ns/lfc.i, rpm/DPM-client.spec, rpm/DPM-mysql.spec, rpm/LFC-client.spec, rpm/LFC-mysql.spec, solaris/prototype.dpmclient, solaris/prototype.lfcclient: Added new methods delreplicasbysfn & registerfiles for NS. Prepare for tag 1.7.2 2009-03-20 12:39 dhsmith - Before 1.7.1: * srmv2/: srmv2.sysconfig.mysql, srmv2.sysconfig.oracle, srmv2.sysconfig.postgresql: Change default for srmv2 daemon to not run * CHANGES, VERSION: Prepare for 1.7.1-1 tag * dpm/Imakefile, ns/Imakefile.lfc, solaris/Makefile, solaris/depend.dpmifce, solaris/depend.lcgdmcmn, solaris/depend.lfcifce, solaris/pkginfo.dpmifce, solaris/pkginfo.dpmifce2, solaris/pkginfo.lfcifce, solaris/pkginfo.lfcifce2, solaris/prototype.dpmifce, solaris/prototype.dpmifce2, solaris/prototype.lfcifce, solaris/prototype.lfcifce2: Add swig interfaces to solaris build, fix voms-api-cpp reference in solaris depend file * CHANGES, rfio/rfio_callhandlers.c, rfio/rfio_serv.c, rfio/rfiod.sysconfig: Added rfiod option to allow definition of hostname used in dpns queries * CHANGES, solaris/prototype.lfcclient: Fix typo in prototype.lfcclient * CHANGES, ns/Cns_libpq_ifce.c: Fix in Cns_libpq_ifce.c * ns/Cns-python_typemaps.i: Fix issue with swig 1.3.29 * VERSION: 2. release candidate * rpm/Makefile: RPM tag can include a release-candidate suffix, if defined. * rpm/: Makefile, sl5.spec.requires, slc3.spec.requires, slc4.spec.requires, suse9.spec.requires, unknown.spec.requires: The Python version is discovered dynamically while generating the RPM spec files. * configure: Non-GNU sed does not recognize '\t', so it is replaced by real tabs. * solaris/: Makefile, depend.copyora, depend.dpmdicommys, depend.dpmdicompsql, depend.dpmora, depend.dpnsora, depend.lfcora, depend.srmora, pkginfo.copyora, pkginfo.dpmdicommys, pkginfo.dpmdicompsql, pkginfo.dpmora, pkginfo.dpnsora, pkginfo.lfcora, pkginfo.srmora, prototype.copyora, prototype.dpmclient, prototype.dpmdicommys, prototype.dpmdicompsql, prototype.dpmora, prototype.dpnsora, prototype.lfcclient, prototype.lfcora, prototype.srmora: Automated Solaris packaging. (by Jean-Philippe) * configure: Automatically disabling the build of Perl and Python interfaces, if 'swig' is not available. * rpm/DPM-dicom.spec: removed duplications * dpm/dpm-drain.c: No need to use ctime_r(), use ctime() for greater portability * CHANGES, config/site.def, dpm/dpm-drain.c, ns/Cns_procreq.c: clear checksum type and value on file reset in Cns_srv_creat, couple of minor changes in dpm-drain 2008-10-23 22:36 dhsmith - Before 1.7.0-2: * CHANGES, VERSION, dpm/dpm_proclreq.c, dpm/dpm_procsubr.c: Fix for passing ENOENT error during put, and let dpm_relonefile() fail if no pfn to release 2008-10-16 10:45 dhsmith - Before 1.7.0: * CHANGES, DPM-oracle.spec, DPM.spec, LFC.spec, dpm/dpm-listspaces, dpm/dpm_procreq.c, dpmcopy/dpmcopy_main.c, ns/nsls.c: Prepare for 1.7.0 tag * dpm/dpm_python.man, ns/lfc_python.man: o Add an example ofr lfc_getlinks and dpns_getlinks * dpm/dpm.i, ns/lfc.i: o Add support of lfc_getlinks and dpns_getlinks in old lfc/dpm python API * ns/Cns-python_typemaps.i: o filesize arg (C type: U-signed64) can now be either int or long in python * dpm/dpm.i, ns/lfc.i: o make typemaps syntax be compliant with new swig (for slc5) o filesize arg (C type: U-signed64) can now be either int or long in python * CHANGES, DPM-dicom.spec, DPM-oracle.spec, DPM.spec, LFC.spec, dpm/dpm_libpq_ifce.c, dpm/dpm_main.c, dpm/dpm_mysql_ifce.c, dpm/dpm_oracle_ifce.pc, dpm/dpm_proclreq.c, dpm/dpm_procreq.c, scripts/dpm-db-310-to-320/Common.pm, scripts/dpm-db-310-to-320/README, scripts/dpm-db-310-to-320/UpdateDpmDatabase.pm, scripts/dpm-db-310-to-320/dpm_db_310_to_320: Migration scripts for yaim to call, use ns filesize for space update, update also s_gid when updating space in db * DPM.spec, config/darwin.cf, dpm/Imakefile, dpm/send2dpm.c, dpmcopy/Imakefile, ns/Imakefile, ns/Imakefile.cns, ns/Imakefile.dpns, ns/Imakefile.lfc, ns/nsshutdown.c, rfio/popen.c, rfio/rfcat.c, rfio/rfchmod.c, rfio/rfdf.c, rfio/rfio_serv.c, rfio/rfstat.c, security/Csec_api_loader.c, security/Csec_plugin_GSS.c, srmv1/Imakefile, srmv2/Imakefile, srmv2.2/Imakefile: Mostly changes for darwin macos, also change in MSG_SPCMD unmarshalling * CHANGES, DPM.spec, LFC.spec, h/Cns_api.h, h/Csec_plugin.h, ns/Cns_du.man, ns/Cns_getreplicas.c, ns/Cns_getreplicas.man, ns/Cns_getreplicasl.c, ns/Cns_getreplicasl.man, ns/Cns_procreq.c, ns/Imakefile, ns/Imakefile.cns, ns/Imakefile.dpns, ns/Imakefile.lfc, ns/send2nsd.c, ns/sendrep.c, security/Csec_api_loader.c, security/Csec_common.c, security/Csec_errmsg.c, security/Csec_plugin_GSS.c, security/Csec_plugin_ID.c, security/Csec_protocol_policy.c, security/Csec_static_loader.c: Remove Cns_du manpage, host from Cns_filereplicas and various platform compilation fixes * dpm/dpm_getspacemd.man, ns/Cns_getreplicas.man, ns/Cns_getreplicasl.man: Update man page * CHANGES, dpm/dpm_procreq.c, dpm/send2dpm.c, h/Cns_api.h, h/dpm_api.h, ns/Cns_getreplicas.c, ns/Cns_getreplicasl.c, ns/Cns_procreq.c, ns/send2nsd.c, ns/sendrep.c: Add client_dn, host to dpm_space_metadata, Cns_filereplicas * dpmcopy/: tenv.c, tget.c, tgetfilesize.c, tping.c, tput.c: Removed some test files * CHANGES, CHANGES-long, DPM-oracle.spec, DPM-postgres.spec, DPM.spec, Imakefile, LFC-postgres.spec, LFC.spec, Makefile.rpm, VERSION, common/remote.c, config/Project.tmpl, config/site.def, dicomcopy/Imakefile, dicomcopy/dicomcopy_libpq_ifce.c, dicomcopy/dicomcopy_postgresql_tbl.sql, dicomcopy/dicomcopy_serv.c, dicomcopy/dicomcopyd.scripts.postgresql, dicomcopy/dicomcopyd.sysconfig.postgresql, dli/Imakefile, dpm/Imakefile, dpm/dpm-drain.man, dpm/dpm-getspacemd.c, dpm/dpm-getspacemd.man, dpm/dpm-reservespace.c, dpm/dpm-reservespace.man, dpm/dpm-updatespace.c, dpm/dpm-updatespace.man, dpm/dpm.i, dpm/dpm.scripts.postgresql, dpm/dpm.sysconfig.postgresql, dpm/dpm2.i, dpm/dpm2_python.man, dpm/dpm_copyfile.c, dpm/dpm_getspacemd.c, dpm/dpm_getspacemd.man, dpm/dpm_getturl.c, dpm/dpm_libpq_ifce.c, dpm/dpm_main.c, dpm/dpm_mysql_drop.sql, dpm/dpm_mysql_ifce.c, dpm/dpm_mysql_tbl.sql, dpm/dpm_oracle_drop.sql, dpm/dpm_oracle_ifce.pc, dpm/dpm_oracle_tbl.sql, dpm/dpm_postgresql_drop.sql, dpm/dpm_postgresql_tbl.sql, dpm/dpm_proclreq.c, dpm/dpm_procreq.c, dpm/dpm_procsubr.c, dpm/dpm_replicate.c, dpm/dpm_reservespace.c, dpm/dpm_reservespace.man, dpm/dpm_updatespace.c, dpm/dpm_updatespace.man, dpm/send2dpm.c, dpm/sendrep.c, dpmcopy/Imakefile, dpmcopy/dpmcopy_inc_reqctr.c, dpmcopy/dpmcopy_local.c, dpmcopy/dpmcopy_main.c, dpmcopy/dpmcopy_pull.c, dpmcopy/dpmcopy_push.c, dpmcopy/dpmcopyd.logrotate, dpmcopy/dpmcopyd.man, dpmcopy/dpmcopyd.scripts.mysql, dpmcopy/dpmcopyd.scripts.oracle, dpmcopy/dpmcopyd.scripts.postgresql, dpmcopy/dpmcopyd.sysconfig.mysql, dpmcopy/dpmcopyd.sysconfig.oracle, dpmcopy/dpmcopyd.sysconfig.postgresql, dpmcopy/oralink.mk, dpmcopy/send2dpmcopyd.c, dpmcopy/srm.v2.2.wsdl, dpmcopy/srmv2_ifce.c, dpmcopy/tenv.c, dpmcopy/tget.c, dpmcopy/tgetfilesize.c, dpmcopy/tping.c, dpmcopy/tput.c, dpmcopy/typemap.dat, h/Cnetdb.h, h/Cns_api.h, h/Cns_server.h, h/Imakefile, h/dpm_api.h, h/dpm_server.h, h/dpmcopy_api.h, h/dpmcopy_constants.h, h/dpmcopy_server.h, h/dpns_api.h, h/lfc_api.h, ns/Cns_du.man, ns/Cns_libpq_ifce.c, ns/Cns_oracle_ifce.pc, ns/Cns_postgresql_drop.sql, ns/Cns_postgresql_tbl.sql, ns/Imakefile, ns/Imakefile.cns, ns/Imakefile.dpns, ns/Imakefile.lfc, ns/dpnsdaemon.scripts.postgresql, ns/dpnsdaemon.sysconfig.postgresql, ns/lfc2_python.man, ns/lfcdaemon.scripts.postgresql, ns/lfcdaemon.sysconfig.postgresql, ns/nsgetacl.c, ns/nsls.c, ns/nsping.c, ns/nsrm.c, rfio/Imakefile, rfio/connect.c, rfio/rfio_call64.c, rfio/rfio_calls.c, rfio/rfio_popen.man, rfio/rfio_pread.man, rfio/rfio_pwrite.man, rfio/rfio_serv.c, rfio/rfioacct.c, rfio/stream.c, rfio/stream64.c, scripts/choose-module, srmv1/Imakefile, srmv1/srmv1.scripts.postgresql, srmv1/srmv1.sysconfig.postgresql, srmv1/srmv1_procreq.c, srmv2/Imakefile, srmv2/srmv2.c, srmv2/srmv2.scripts.postgresql, srmv2/srmv2.sysconfig.postgresql, srmv2/srmv2_permreq.c, srmv2/srmv2_spacereq.c, srmv2/srmv2_xferreq.c, srmv2.2/Imakefile, srmv2.2/srmv2.2.scripts.postgresql, srmv2.2/srmv2.2.sysconfig.postgresql, srmv2.2/srmv2.c, srmv2.2/srmv2_dirreq.c, srmv2.2/srmv2_permreq.c, srmv2.2/srmv2_spacereq.c, srmv2.2/srmv2_xferreq.c, test/Imakefile, test/dpm/dpm_testcopy.c: Prepare for 1.7 series. Addition of dpmcopy, multiple groups on spaces and several other changes - Before 1.6.12: * CHANGES, DPM.spec, LFC.spec, dpm/Imakefile, dpm/dpm-listspaces, dpm/dpm-listspaces.man, h/Cns_api.h, h/dpns_api.h, h/lfc_api.h, ns/Cns_procreq.c, ns/Cns_setfsize.c, ns/Cns_setfsize.man, ns/Cns_setfsizeg.man, ns/Imakefile.dpns, ns/Imakefile.lfc: Add dpm-listspaces and Cns_setfsizec and prepare for 1.6.12 retag * dpm/: dpm_main.c, dpm_proclreq.c, dpm_procreq.c: Use dpns transactions during dpm_srv_proc_put * dpm/dpm_procreq.c, srmv1/srmv1_procreq.c, srmv2/srmv2_xferreq.c, srmv2.2/srmv2_xferreq.c: Avoid returning negative size during put cycle * dpm/dpm_procreq.c: Possibility of deref NULL pointer * dpm/: dpm-drain.c, dpm_main.c, dpm_proclreq.c, dpm_procreq.c: Better check that fs are still in the configuration within dpm-drain, don't always unlink name entries of aborted put requests * CHANGES, DPM.spec, LFC.spec: Remove lfc2/dpm2 for now & add change log entry for bug 40927 (remove name on removal of last replica) * dpm/dpm-drain.c: Retry timeouts of Cns_listreplicax * dpm/dpm-drain.c, dpm/dpm_procreq.c, ns/Cns_main.c: Check for Cns_listreplicax timeouts during dpm-drain * dpm/dpm_proclreq.c, dpm/dpm_procreq.c, dpm/poolmgr.c, h/dpm_server.h: Small change of pool free space accounting when removing a replica in a space on a non RW fs * CHANGES, DPM-dicom.spec, DPM-oracle.spec, DPM.spec, LFC-oracle.spec, LFC.spec, dpm/dpm-drain.c, dpm/dpm-drain.man, dpm/dpm-python_typemaps.i, dpm/dpm-replicate.c, dpm/dpm-replicate.man, dpm/dpm2.i, dpm/dpm2_python.man, dpm/dpm_main.c, dpm/dpm_proclreq.c, dpm/dpm_procreq.c, dpm/dpm_replicate.c, dpm/poolmgr.c, h/Cns.h, h/Cns_api.h, h/dpm_api.h, h/dpm_constants.h, h/dpns_api.h, h/lfc_api.h, ns/Cns.i, ns/Cns_main.c, ns/Cns_modreplica.c, ns/Cns_modreplica.man, ns/Cns_modreplicax.man, ns/Cns_procreq.c, ns/Imakefile.dpns, ns/Imakefile.lfc, ns/lfc2_python.man: Changes for bugs 40553, 40273 (drain related) 2008-04-14 22:59 szamcsi - Before 1.6.10-5: * configure, config/site.def, dli/Imakefile, project/e-c_LCG-DM.ini, srmv1/Imakefile, srmv2/Imakefile, srmv2.2/Imakefile, test/srmv1/Imakefile, test/srmv2/Imakefile, test/srmv2.2/Imakefile: Making it build with gSOAP v2.7.6b and v2.7.10. To be compatible with the pointer usage of for snprintf prototype * ns/dpnsdaemon.scripts.oracle: Do not assume that the lib directory is called 'lib'. On x86_64 it is 'lib64', however Oracle already configured ld.so.conf by this point, so we can safely skip setting it in LD_LIBRARY_PATH. Keeping that setting for backward compatibility. * dpm/dpm-addpool.c: code cleanup * dicomcopy/send2dicomcopyd.c: include to avoid warning at compile time * common/getifnam.c: use socklen_t instead of int for the 3rd getsockname argument * common/isTrustedHost.c: include to avoid warning at compile time * VERSION: 1.6.7-3 * dpm/dpm_procreq.c: JPB: fixing dpm-drain problems * common/Cnetdb.c: add support for MacOSX * dpm/dpm_procreq.c: fix problem of replication of a zero-length file improve logging of updatefilestatus method * LFC-oracle.spec: yet another typo * DPM.spec, LFC.spec, lcg-dm-common.spec, common/Imakefile, h/Imakefile: Installing and packaging Cnetdb.h and Cnetdb.man, as it is needed to build DPM-DSI. * rfio/: feof.c, ferror.c, fread.c, fseek.c, fseeko64.c, fwrite.c, getc.c, rfio_serv.c, rfstatfs.c, switch_req.c: add support for MacOSX on Intel platforms * h/: osdep.h, rfcntl.h, rfio_api.h: add support for MacOSX on Intel platforms * config/Imake.tmpl, imake/imakemdep.h: add support for MacOSX on Intel platforms * common/: Cgrp.c, Cinitdaemon.c, Cpwd.c, log.c, serror.c: add support for MacOSX on Intel platforms * common/Cnetdb.c: include and to avoid warnings at compile time * LFC.spec, ns/Imakefile.lfc: Adding man page of getreplicasl to the package and syncing up the ordering (closes bug#32818). * ns/: nsenterclass.man, nsfind.man, nslistclass.man, nsls.man, nsmodifyclass.man: Removing the last references to /etc/passwd and /etc/group in the man pages (closes bug#18836) * dpm/dpm_mysql_ifce.c: include for sprintf prototype * ns/Cns_mysql_ifce.c: include for sprintf prototype * ns/Cupv_check.c: include for sprintf prototype * ns/Cns_acl.c: include for sprintf prototype * dpm/dpm-drain.c: include to get proto for exit function * ns/: nschmod.c, nsmkdir.c, nsping.c, nsrename.c: include to get proto for exit function * dpm/: dpm-ping.c, dpm-replicate.c, dpm-shutdown.c: include to get proto for exit function * dpm/dpm-getspacetokens.c: include to avoid compilation error on MacOSX * dpm/dpm-getspacemd.c: include and to avoid compilation errors on MacOSX * ns/: nslistgrpmap.c, nslistusrmap.c: include to avoid warning at compile time * DPM-dicom.spec, DPM-oracle.spec, DPM.spec, LFC-oracle.spec, LFC.spec: MySQL and Oracle flavours of the same service should conflict (closes bug#32981). * scripts/lcg-info-provider-lfc: Changing the LDAP DN of the published service from mds-vo-name=local to mds-vo-name=resource (closes bug#32978, bug#31157 and ggus#31741). * scripts/Migration-LFC-MySQL-Oracle/src/mysql_info.cpp: add mysql error when store result failed * dicomcopy/dicomcopy_serv.c: reinitialise CSEC context each time rather than only initialise * dicomcopy/dicomcopy_serv.c, dicomcopy/dicomcopyd.man, dicomcopy/send2dicomcopyd.c, dpm/dpm_copyfile.c, dpm/dpm_main.c, ns/Cns_main.c, rfio/connect.c, rfio/rfio_serv.c, security/Csec_plugin_GSS.c: IPv6 changes for dicomcopy & dpm_copyfile.c and a few error message corrections or additions * common/Cnetdb.man, h/dli_server.h, h/srm_server.h: Increase SRM&DLI receieve timeout and small typo fix in Cnetdb man page * lcg-dm-common.spec: missed from the RPM spec rearrangements * ns/Cns_chkperm.c: Zero length path should return EINVAL instead of ENOENT in chkperm. * ns/Cns_procreq.c: Fixed permission handling of chown/lchown. * DPM-dicom.spec, DPM-oracle.spec, DPM.spec, LFC-oracle.spec, LFC.spec, Makefile.rpm, VERSION, build.xml, configure, setosflags, project/Makefile.etics, project/e-c_LCG-DM.ini, scripts/choose-module: Adding build of DPM-dicom and enable re-builds from source RPMs. * dicomcopy/dicomcopyd.man: doc updates * dicomcopy/Imakefile: missed spool dir * config/site.def: Swig from the OS is good enough, so changing the default location to /usr. * dpm/dpm_updatefilestatus.c: Missed this one. * Imakefile, setosflags, config/Project.tmpl, config/site.def, dicomcopy/Imakefile, dicomcopy/dicomcopy_inc_reqctr.c, dicomcopy/dicomcopy_mysql_ifce.c, dicomcopy/dicomcopy_mysql_tbl.sql, dicomcopy/dicomcopy_oracle_ifce.pc, dicomcopy/dicomcopy_oracle_tbl.sql, dicomcopy/dicomcopy_serv.c, dicomcopy/dicomcopyd.logrotate, dicomcopy/dicomcopyd.man, dicomcopy/dicomcopyd.scripts.mysql, dicomcopy/dicomcopyd.scripts.oracle, dicomcopy/dicomcopyd.sysconfig.mysql, dicomcopy/dicomcopyd.sysconfig.oracle, dicomcopy/dpm_dicomcopyfile.c, dicomcopy/oralink.mk, dicomcopy/send2dicomcopyd.c, dpm/Imakefile, dpm/dpm_main.c, dpm/dpm_mysql_ifce.c, dpm/dpm_oracle_ifce.pc, dpm/dpm_proclreq.c, dpm/dpm_procreq.c, h/dicomcopy_api.h, h/dicomcopy_constants.h, h/dicomcopy_server.h, h/dpm.h, h/dpm_backend.h, h/dpm_constants.h, h/dpm_dicom.h, srmv1/srmv1_procreq.c, srmv2/srmv2_xferreq.c, srmv2.2/srmv2_dirreq.c, srmv2.2/srmv2_xferreq.c: Import of the DPM-DICOM prototype sources. 2008-01-11 09:56 szamcsi - Before 1.6.9: * common/Cnetdb.c: Fix forward lookup to account for mapped/compat addresses * CHANGES-long, common/Cnetdb.man: Added Cnetdb man page and another change log addition. * CHANGES, CHANGES-long, dli/Imakefile: Some change log updates/DLI Imakefile fix * CHANGES, common/Cdomainname.c, common/Cnetdb.c, common/getifnam.c, common/isTrustedHost.c, common/remote.c, common/serror.c, common/setnetio.c, dli/Imakefile, dli/dli.c, dpm/dpm.man, dpm/dpm_main.c, dpm/dpm_procreq.c, dpm/dpm_util.c, dpm/send2dpm.c, h/Cnetdb.h, h/Cns_server.h, h/Csec_api.h, h/Csec_common.h, h/Csec_constants.h, h/Csec_plugin.h, h/Csec_protocol_policy.h, h/dli_server.h, h/rfio_constants.h, h/sacct.h, h/srm_server.h, ns/Cns_chkperm.c, ns/Cns_main.c, ns/Cns_procreq.c, ns/nsdaemon.man, ns/send2nsd.c, rfio/checkkey.c, rfio/connect.c, rfio/open.c, rfio/open64.c, rfio/opendir.c, rfio/parse.c, rfio/rfio_call64.c, rfio/rfio_calls.c, rfio/rfio_fcalls.c, rfio/rfio_serv.c, rfio/rfioacct.c, rfio/rfiod.man, rfio/stat.c, rfio/stream.c, rfio/stream64.c, security/Csec_api.c, security/Csec_api.man, security/Csec_api_loader.c, security/Csec_apiinit.c, security/Csec_common.c, security/Csec_errmsg.c, security/Csec_plugin_GSS.c, security/Csec_plugin_ID.c, security/Csec_plugin_KRB4.c, security/Csec_protocol_policy.c, security/Csec_static_loader.c, srmv1/Imakefile, srmv1/srmv1.c, srmv1/srmv1_procreq.c, srmv2/Imakefile, srmv2/srmv2.c, srmv2/srmv2_dirreq.c, srmv2/srmv2_permreq.c, srmv2/srmv2_spacereq.c, srmv2/srmv2_xferreq.c, srmv2.2/Imakefile, srmv2.2/srmv2.c, srmv2.2/srmv2_dirreq.c, srmv2.2/srmv2_discovreq.c, srmv2.2/srmv2_permreq.c, srmv2.2/srmv2_spacereq.c, srmv2.2/srmv2_xferreq.c, test/ns/delete_files.c, test/ns/delete_files_rate.c, test/ns/nested_symlinks.c, test/ns/query_files.c, test/ns/query_rate.c, test/ns/read_files.c, test/ns/read_rate.c, test/ns/stat_replicas.c, test/ns/symlinks.c, test/srmv1/Imakefile, test/srmv2/Imakefile, test/srmv2.2/Imakefile: IPv6 support, Csec and general logging changes * Changes in various files to support accepting and establishing connections using IPv6 - changes for the nameserver, dpm server, rfio library, Castor common routines, various header files - build now involves compilation of gSOAP (with IPv6 support) for the SRMs and DLI. - The nameserver, dpm server, and rfio daemon can take new command line switches to limit which protocols they will accept connections on. The default is to listen for either IPv4 or IPv6 if supported by the system. Updated man pages with new command line options. - Clients will attempt to use either IPv6 or IPv4 depending upon whether the result of address lookups yield IPv6 addresses and whether the system has any configured IPv6 interfaces. - Added "Cnetdb" man page including details of new utility function, Cgetnetaddress(). * DPM - explicitly disallow ':' character in filesystem server names when adding pools. - Set the VOMS authorization data as well as the authoriation ID data when making an initial Cns_getidmap call to the name server. * SRM/DLI - added gSOAP receive timeout of 5 seconds * Logging - In general, failed connections to the nameserver or DPM server have the numeric IP address of the peer added to the logging information - Added DN and indication of presence of VOMS extensions to virtual ID lookup failure error - More error reporting on Csec failures * Csec changes - Csec protocol changed to better indicate to the peer if the authentication dialogue fails or has to be aborted. This facilitates clearer logging. Changes are backward compatible between clients/servers or servers/clients. - Moved some thread specific variables which were common to all threads to a non thread specific location. - Added some extra checks in protocol handing routines. - Changes internal handling of VOMS authorisation data, that ay be present in the protocol negoication dialogue. * RFIO fix - Applied fix for potential file trunctation when the file length is a multiple of internal circular buffer size (usually 256K), for V3 64 bit-offset streaming mode. Castor bug 30223. 2008-01-09 11:51 szamcsi - Before 1.6.8: * CHANGES: add comment for bug 29512 * dpm/Imakefile: fix bug #29512: add CLI to list space tokens and associated metadata * dpm/: dpm-getspacemd.c, dpm-getspacemd.man, dpm-getspacetokens.c, dpm-getspacetokens.man: Initial release * dpm/dpm_procreq.c: getspacemd: fix reporting of remaining lifetime when infinite * setosflags: add support for MacOSX * dpm/dpm_procreq.c: better error messages: - "Negative value for f_lifetime" while checking dpm_copy requests - "No accessible space token" in dpm_getspacetoken - "File size mismatch" when replicating a file * dpm/: dpm-register.c, dpm-register.man: change default ownership from root:root to the requester's DN and group * CHANGES: add comment for bug 31697 * h/Cns_constants.h, ns/Cns_main.c, ns/Cns_procreq.c: fix bug 31697: protect server from bad bol and listentsz values * dpm/dpm.scripts.oracle, ns/lfcdaemon.scripts.oracle: Do not assume that the lib directory is called 'lib'. On x86_64 it is 'lib64', however Oracle already configured ld.so.conf by this point, so we can safely skip setting it in LD_LIBRARY_PATH. Keeping that setting for backward compatibility. * ns/lfc.i: o Add lfc_getreplicasl in swig interface * h/Cns.h, h/Cns_api.h, h/lfc_api.h, ns/Cns_main.c, ns/Cns_procreq.c, ns/Imakefile.lfc: add bulk method Cns_getreplicasl requested by LHCb * ns/: Cns_getreplicasl.c, Cns_getreplicasl.man: Initial release * project/e-c_LCG-DM.ini: updated the ETICS confoguration template for ETICS client >= 1.3 * dpm/dpm_python.man: o Add "Known bugs" paragraph * DPM.spec: add dpm_python man page * dpm/Imakefile: add rules for dpm_python man page * ns/lfc_python.man: o Cut lines and fix content * dpm/dpm_python.man: o Cut lines and fix content * dpm/dpm_python.man: o Add dpm_python.man (examples of use of python methods for DPM/DPNS) * ns/lfc_python.man: o Update lfc_python.man with examples for lfc_getusrmap and lfc_getgrpmap methods * dpm/dpm.i: o Add dpns_getusrmap and dpns_getgrpmap to SWIG interfaces * ns/lfc.i: o Add lfc_getusrmap and lfc_getgrpmap to SWIG interfaces * h/: dpns_api.h, lfc_api.h: fixed bug #29511: Add a command line tool to list virtual uids and gids defined * scripts/change-se-name/update_sfn_path.sql: update sfn function to delete only old entries if the host is given * scripts/change-se-name/update_sfn_path.sql: new script to update host and sfn entries in the lfc : this one should be used * CHANGES, DPM.spec: add new bulk methods for Atlas * ns/: Cns_delfilesbyguid.c, Cns_delfilesbyguid.man, Cns_delfilesbyname.c, Cns_delfilesbyname.man, Cns_delfilesbypattern.c, Cns_delfilesbypattern.man, Cns_delreplicas.c, Cns_delreplicas.man, Cns_readdirxp.c, Cns_readdirxp.man: Initial release * LFC.spec: add new bulk methods for Atlas * h/Cns.h, h/Cns_api.h, h/Cns_server.h, h/dpns_api.h, h/lfc_api.h, ns/Cns_main.c, ns/Cns_mysql_ifce.c, ns/Cns_oracle_ifce.pc, ns/Cns_procreq.c, ns/Imakefile.dpns, ns/Imakefile.lfc, ns/send2nsd.c, ns/sendrep.c: add new bulk methods for Atlas * DPM.spec, LFC.spec: fixed bug #29511: Add a command line tool to list virtual uids and gids defined * CHANGES: add fixes for bugs 29511 and 30234 * h/: Cns.h, Cns_api.h, Cns_server.h, Cns_struct.h, dpns_api.h, lfc_api.h: fixed bug #29511: Add a command line tool to list virtual uids and gids defined * ns/: Cns_main.c, send2nsd.c, sendrep.c: fixed bug #29511: Add a command line tool to list virtual uids and gids defined * ns/Cns_procreq.c: only require read permission to delete secondary replica fixed bug #29511: Add a command line tool to list virtual uids and gids defined * ns/: Imakefile.dpns, Imakefile.lfc: fixed bug #29511: Add a command line tool to list virtual uids and gids defined * ns/: Cns_mysql_ifce.c, Cns_oracle_ifce.pc: fixed bug #30234: lfc-modifyusrmap returns "Internal Error" - unique constraint violated fixed bug #29511: Add a command line tool to list virtual uids and gids defined * ns/: Cns_modifygrpmap.man, Cns_modifyusrmap.man, nsmodifygrpmap.c, nsmodifyusrmap.c: fixed bug #30234: lfc-modifyusrmap returns "Internal Error" - unique constraint violated * ns/: Cns_getgrpmap.c, Cns_getgrpmap.man, Cns_getusrmap.c, Cns_getusrmap.man, nslistgrpmap.c, nslistgrpmap.man, nslistusrmap.c, nslistusrmap.man: Initial release * dpm/poolmgr.c: root could not use updatespace to increase the size of a space if it was in a dedicated pool * ns/: lfcdaemon.scripts.mysql, lfcdaemon.scripts.oracle, lfcdaemon.sysconfig.mysql, lfcdaemon.sysconfig.oracle: Changing DISABLEVIRTUALIDS into DISABLEAUTOVIDS. * ns/Cns_mysql_ifce.c: fix in Cns_update_unique_gid (same problem as in bug 31981) * ns/Cns_mysql_ifce.c: fixing bug#31981 -- tested * CHANGES: Added fixed bug #31976: [LFC] "-n" option missing from init.d and sysconfig files * ns/: lfcdaemon.scripts.mysql, lfcdaemon.scripts.oracle, lfcdaemon.sysconfig.mysql, lfcdaemon.sysconfig.oracle: Fix for bug #31976: added the possibility to disable the virtual ids automatic creation in /etc/sysconfig/lfcdaemon and /etc/init.d/lfcdaemon. * DPM-oracle.spec, DPM.spec, LFC-oracle.spec, LFC.spec, lcg-dm-common.spec: Changed RPM dependency to CGSI_gSOAP_2.7 >= 1.2.1-2 and glite-security-voms >= 1.7.24 * rfio/rfio_fcalls.c: Change to not test return code of setgroups() * CHANGES, rfio/lstat.c, rfio/mstat.c, rfio/open.c, rfio/open64.c, rfio/rfdir.c, rfio/rfio_calls.c, rfio/stat.c, rfio/statfs.c, rfio/stream.c, rfio/stream64.c: Removal of open/stat/statfs fallbacks in RFIO * dpm/Imakefile, ns/Imakefile.lfc: Swig libraries can be located in lib, lib64 or share, depending on the distribution. * scripts/get-platform-os: Ubuntu 7.10 is binary compatible with SL5 * imake/: ccimake.c, imake.c: gcc 4 is more strict on prototypes -- make it work on SL5 * srmv2/srmv2_permreq.c, srmv2.2/srmv2_permreq.c: remove compilation errors on SL5 * security/Csec_common.c: Added check in Csec token function * security/: Csec_api_loader.c, Csec_common.c: Fix excessively wasteful _Csec_print_token() and avoid dangling pointer in _try_activate_func() 2007-11-02 00:24 szamcsi - Before 1.6.7: * CHANGES: fix #28838, fix #30669, DPM python * dpm/dpm_mysql_ifce.c, ns/Cns_mysql_ifce.c: fix bug #30669: LFC/DPM have difficulties with a DN containing a ' * VERSION: Upgrading to 1.6.7-1. * CHANGES-long: Adding long CHANGES before tagging 1.6.7. * CHANGES: minor. * dpm/dpm_main.c, ns/Cns_main.c: return SEOPNOTSUP instead of SEINTERNAL in case of method not supported * dpm/dpm.i: o Add new dpm_ functions to the python swig interface * dpm/: Imakefile, dpm_replicate.c: get rid of dependency on rfio in dpm client * h/rfio_api.h, rfio/rfio_HsmIf.c: Added function rfio_HsmIf_SetCnsWrittenTo() to rfio_api.h and rfio_HsmIf.c * ns/nsls.man: display 'S' when S_ISUID or S_ISGID is set and the execution bit is not * ns/nsls.c: display 'S' when S_ISUID or S_ISGID is set and the execution bit is not * dpm/dpm-register.man: fix typos * config/site.def, dli/Imakefile, dpm/Imakefile, ns/Imakefile, security/Imakefile, srmv1/Imakefile, srmv2/Imakefile, srmv2.2/Imakefile, test/srmv1/Imakefile, test/srmv2/Imakefile, test/srmv2.2/Imakefile: VOMS v1.7.23 and CGSI_gSOAP v1.2.1-2 installs its libraries into 'lib64' on x86_64 platforms to avoid clashes with dual-arch installations. The build paths had to be modified accordingly. We still keep 'lib' even in this case for older versions of these dependencies. * ns/Cns_procreq.c: fix processing of S_ISGID bit, especially when secondary groups are involved * ns/: Cns_main.c, Cns_procreq.c, nsdaemon.man: add option -n to disable the automatic creation of virtual ids * ns/Cns_procreq.c: fix lines indentation * dpm/dpm_replicate.c: fix a memory leak (to_turl was not freed) 2007-09-25 16:17 szamcsi - Before 1.6.6-3: * ns/lfc_python.man: form fixes (typos and presentation) * dpm/dpm-drain.man: add option gid and group Savannah bug 25065 * CHANGES: add option gid and group (Savannah bug #25065) * dpm/dpm-drain.c: add option gid and group Savannah bug 25065 * test/python/lfc/lfc-create-subfolders.py: This script creates subfolders in the folder given as first parameter. The number of subfolders is the second parameter. It uses the lfc_mkdir method. * CHANGES: Fixed lfc_readdirxr example (bug 20880) * ns/lfc_python.man: Fixed lfc_readdirxr example (bug 20880) * h/dpm_api.h: do not generate Python/Perl plugins for dpm_copyfile and dpm_replicate as these 2 methods are not part of the dpm library * test/python/lfc/lfc-perf-symlinks-submit.pl: Update for 'glite-wms-job-submit' using delegated proxy whose name is contained in the 'LCG_GFAL_VO' environment variable * test/python/lfc/: lfc-perf-symlinks-submit.pl, atlas/atlas-lfc-perf-symlinks-hosts.pl: This script uses the 'lfc-perf-symlinks.jdl.template' file to create a JDL, then submits it to all computing elements in the same domain as the LFC hosts listed in the file given as second parameter or else specified in the 'LFC_HOSTS_FILE' environment variable. Remove ATLAS-specific code and move the script to the 'lfc' folder. * test/python/lfc/atlas/atlas-lfc-hosts.txt: Netherlands : Atlas LFC host is now 'lfc-atlas.grid.sara.nl' - Test LFC host is now 'eg.nikhef.nl' 2007-09-11 17:17 slemaitr - Before 1.6.6-2: * test/ns/python/: lfc_chdir_test.py, lfc_delcomment_test.py, lfc_delete_test.py, lfc_getacl_test.py, lfc_getcwd_test.py, lfc_rename_test.py, lfc_rmdir_test.py, lfc_setacl_test.py, lfc_setatime_test.py, lfc_undelete_test.py, lfc_unlink_test.py: Import of python tests * h/srm_server.h, srmv1/srmv1.c, srmv2/srmv2.c, srmv2.2/srmv2.c: suppress definition of srm_thread_info structure in srm_server.h and always use the definition from dpm_server.h (the lack of synchronization between the two versions broke the SRMs with Oracle when more than one active client) * dpm/dpm_oracle_ifce.pc: fix end-of-list reporting in dpm_list_expired_spaces * dpm/dpm_main.c: commit modifications one at a time when removing expired spaces * test/ns/python/: lfc_creatg_test.py, lfc_mkdir_test.py, lfc_mkdirg_test.py, lfc_setcomment_test.py, lfc_setfsize_test.py, lfc_setfsizeg_test.py, lfc_stat_test.py, lfc_statg_test.py, lfc_statr_test.py, lfc_statx_test.py, testClass.py: Import of python tests * srmv1/srmv1.c, srmv2/srmv2.c, srmv2.2/srmv2.c: Removed the sigprocmask() settings from the start of the srm servers: should be unnessary with VOMS api >= 1.7.20 * CHANGES, CHANGES-long, VERSION, rfio/rfio_calls.c, rfio/rfio_fcalls.c, srmv2.2/srmv2_dirreq.c: backported fixes for bug#28499 * DPM-oracle.spec, DPM.spec, LFC.spec, VERSION, config/sl5.spec.requires, dpm/dpm_copyfile.c, dpm/dpm_main.c, dpm/dpm_mysql_ifce.c, dpm/dpm_oracle_ifce.pc, dpm/dpm_proclreq.c, dpm/dpm_procreq.c, dpm/poolmgr.c, h/dpm_server.h, ns/Cns_accessr.man, ns/Imakefile.dpns, ns/Imakefile.lfc, ns/nschgrp.c, ns/nsping.c, ns/nsshutdown.c, ns/nstouch.c, rfio/rfio_calls.c, rfio/rfio_fcalls.c, scripts/get-platform-os, scripts/lcg-info-provider-lfc, security/Csec_api.c, security/Csec_common.c, srmv1/srmv1_procreq.c, srmv2/srmv2_dirreq.c, srmv2/srmv2_spacereq.c, srmv2/srmv2_xferreq.c, srmv2.2/srmv2_dirreq.c, srmv2.2/srmv2_spacereq.c, srmv2.2/srmv2_xferreq.c: It would be too much for a -5... * DPM-oracle.spec, DPM.spec, LFC.spec, VERSION, config/sl5.spec.requires, dpm/dpm_copyfile.c, dpm/dpm_main.c, dpm/dpm_mysql_ifce.c, dpm/dpm_oracle_ifce.pc, dpm/dpm_proclreq.c, dpm/dpm_procreq.c, dpm/poolmgr.c, h/dpm_server.h, ns/Cns_accessr.man, ns/Imakefile.dpns, ns/Imakefile.lfc, ns/nschgrp.c, ns/nsping.c, ns/nsshutdown.c, ns/nstouch.c, rfio/rfio_calls.c, rfio/rfio_fcalls.c, scripts/get-platform-os, scripts/lcg-info-provider-lfc, security/Csec_api.c, security/Csec_common.c, srmv1/srmv1_procreq.c, srmv2/srmv2_dirreq.c, srmv2/srmv2_spacereq.c, srmv2/srmv2_xferreq.c, srmv2.2/srmv2_dirreq.c, srmv2.2/srmv2_spacereq.c, srmv2.2/srmv2_xferreq.c: Backporting fixes from 1.6.6-1, except the new Python library and the gSOAP 2.6.2->2.7.6b update. * srmv2.2/srmv2_dirreq.c: fix caching of user/group decoding fix processing of srmLs when nblevels == 0 * srmv2/srmv2_dirreq.c: fix caching of user/group decoding * ns/lfc_python.man: fix lfc_readdirxr example * dpm/dpm_copyfile.c: uses globus_error_print_friendly() with VDT 1.6 (globus 4) * rfio/: rfio_calls.c, rfio_fcalls.c: Dropping secondary groups as well when doing setuid/setgid. * ns/: nschgrp.c, nsping.c, nsshutdown.c, nstouch.c: fix tabulation * ns/lfc_python.man: Added information about the thread enabled library * security/: Csec_api.c, Csec_common.c: Added hostname check in isIdAService() and fixed some possible leaks/inconcistent buffer in _Csec_recv_token() * project/e-c_LCG-DM.ini: Removing runtime dependencies of the LCG-DM ETICS configuration. * ns/lfcthr.i: Fixed order to add correctly the exception * LFC.spec, ns/Imakefile.lfc, ns/lfcthr.i: Fixes for thread-enabled Python interface * CHANGES: add fix for bug #27627 * DPM.spec: Added srmv2.2 in the messages for postinstall. * dpm/dpm_procreq.c: allow dpm-updatespace/dpm-releasespace to work on space token description even when space reserved by root for another group better error message if unknown pool specified in reservespace * dpm/poolmgr.c, h/dpm_server.h: better error message if unknown pool specified in reservespace * socket/dpmcli/: dpm-resp.c, dpm-spmd.c: Fixes due to changes in API. GG. * socket/dpmcli/: dpm-Ls.c, dpm-Rm.c, dpm-abortreq.c, dpm-addfs.c, dpm-addreplica.c, dpm-copy.c, dpm-delreplica.c, dpm-extendfilelife.c, dpm-get.c, dpm-getpoolfs.c, dpm-getpools.c, dpm-getprotocols.c, dpm-getreqid.c, dpm-getreqstatus.c, dpm-getreqsummary.c, dpm-modifyfs.c, dpm-put.c, dpm-putdone.c, dpm-relfiles.c, dpm-replicate.c, dpm-rm.c, dpm-spmd.c, dpm-testPutTwo.c: Fix the sizeof(int) mistake. GG. * test/srmv2.2/: srm2_testCopy.c, srm2_testLs.c, srm2_testMkdir.c, srm2_testMv.c, srm2_testPut.c, srm2_testPutDone.c: Temporary removal of CGSI_OPT_DELEG_FLAG, until problem with gSOAP 2.7.6b is fixed. GG. * test/: dpm/socketSuite, srmv2/srmv2Suite, srmv2.2/srmv2Suite: Tuning to allow for running from the pseudo_UI:lxb5407. GG. * test/dpm/globalSuite: LD_LIBRARY_PATH setup fix. GG. * test/: srmv1/Imakefile, srmv1/typemap.dat, srmv2/Imakefile, srmv2.2/Imakefile: Moving to gSOAP 2.7.6.b. GG. * dpm/dpm_main.c: avoid reqctr becoming negative * test/srmv2.2/srmv2Suite: One more adjustement for INFc test timings. GG. * test/dpm/globalSuite: Added lxb2036 to the gang of possible tested machines (for TSTG nightly tests). GG. 2007-07-12 16:39 szamcsi - Before 1.6.6: * DPM-oracle.spec, DPM.spec, LFC-oracle.spec, LFC.spec, config/site.def, project/build.properties, project/e-c_LCG-DM.ini: gSOAP 2.6.2 -> 2.7.6b update in the build and RPM spec files * DPM.spec, LFC.spec: add accessr man page * ns/: Imakefile.lfc, Imakefile.dpns: add accessr man page * ns/Cns_accessr.man: Initial release * scripts/dpm-secondary-groups/: UpdateDpmDatabase.pm, dpm_secondary_groups: Much more efficient way of updating the groups field in dpm_req, dpm_pending_req and dpm_pool. * dli/Imakefile, dli/typemap.dat, srmv1/Imakefile, srmv1/typemap.dat, srmv2/Imakefile, srmv2.2/Imakefile: support for gsoap 2.7.6b * DPM-oracle.spec, DPM.spec: Note saying that the migration script is automatically run by YAIM. * CHANGES: Added fixed bug #27810. * scripts/lcg-info-provider-lfc: Fixed bug #27810: added GlueServiceUniqueID attributes. * scripts/lcg-info-provider-lfc: fix GGUS-Ticket-ID: #24138: LFC information provider does not publish FQDN * config/sl5.spec.requires, scripts/get-platform-os: first shot at the SL5 build by Eamonn * CHANGES, CHANGES-long, VERSION: merging the 1.6.5-4 release from the branch to HEAD 2007-06-28 16:45 szamcsi - Before 1.6.5-4: * DPM.spec, config/slc3.spec.requires, config/slc4.spec.requires, config/suse9.spec.requires, config/unknown.spec.requires: perl-DBD-MySQL is called perl-DBD-mysql on SLC3 for gLite... 2007-06-22 14:27 szamcsi - Before 1.6.5-3: * DPM.spec: DPM-name-server-mysql requires perl-DBD-MySQL for migration. * dpm/dpm_proclreq.c, dpm/dpm_util.c, h/dpm_server.h: better logging of request and sub-request (file) errors * DPM-oracle.spec, DPM.spec, LFC-oracle.spec, LFC.spec, lcg-dm-common.spec: Adding AutoReqProv:no everywhere to solve the x86_64 dependency problems with mismatching ()(64bit) strings added to the .so names. * project/Makefile.etics: An empty PROC_INIT will disable the build of oracle components. * config/suse9.spec.requires: RPM dependencies for Suse9 by Eamonn Kenny * scripts/get-platform-os: Compatible OS: sl3 and rhel3 is recognized as slc3; centos4 and sl4 is recognized as slc4. This is good enough for the RPM dependencies. 2007-06-13 10:23 szamcsi - Before 1.6.5-2: * test/python/lfc/lfc-perf-symlinks-purge-hosts.sh: Try to delete the worker node subfolder only if it is empty : Replace erroneous '==' string comparison by '-eq' numeric comparison * test/: dpm/globalSuite, srmv2.2/srmv2Suite: Last fixes to tune timings for stress tests. GG. * CHANGES: Added bug #26987 fixed. * scripts/: change-dpm-name/changeDpmName, dpm-secondary-groups/dpm_secondary_groups, dpm-support-srmv2.2/dpm_support_srmv2.2, multiple-domains/updateDomainName: fix for bug #26987: all scripts now return "xxxxxx" instead of the actual database password. * test/python/lfc/atlas/atlas-lfc-hosts.txt: UK : LFC host name is in fact 'lfc.gridpp.rl.ac.uk' * test/python/lfc/lfc-perf-symlinks-purge-hosts.sh: Try to delete the worker node subfolder only if it is empty * test/python/lfc/lfc-perf-symlinks-matrix.pl: Flush STDOUT automatically * scripts/get-platform-os: should work even with unrecognizable issue.net files, like the ones on lxplus.cern.ch 2007-05-30 10:13 szamcsi - Before 1.6.5: * srmv1/srmv1.c, srmv2/srmv2.c, srmv2.2/srmv2.c: workaround for a VOMS initialization problem which was disabling all signals * scripts/generate-CHANGES-long: polished version to generate exactly the current format of CHANGES-long * scripts/generate-CHANGES-long: generating CHANGES-long * dpm/dpm_oracle_ifce.pc: fix typo in cursor name * dpm/: dpm_addpool.c, dpm_procreq.c: avoid crash when no gid is specified in addpool * ns/Cns_oracle_ifce.pc: allow null strings as linkname * test/ns/: create_files.c, create_files_rate.c: fix compilation error on SLC4 * test/srmv2.2/: srmv2Stress, srmv2Suite: Small fix due to srmv2Stress. * DPM-interfaces.spec, DPM.spec, Imakefile, LFC-interfaces.spec, LFC.spec, lcg-dm-common.spec, config/site.def, config/slc3.spec.requires, config/slc4.spec.requires, config/unknown.spec.requires, project/Makefile.etics: - Resolving RPM dependencies according to the OS environment using OS specific requirements specifications (config/*.spec.requires). - Installing and packaging libraries to the lib64 subdirectory on x86_64 to allow parallel installation of 32 and 64 packages. * build.xml: [no log message] * build.xml: PROC_INIT is necessary to build the Oracle components too * project/Makefile.etics: Anchoring the location patterns of config/site.def by a starting space. * dpm/dpm_main.c, ns/Cns_main.c, srmv1/srmv1.c, srmv2/srmv2.c, srmv2.2/srmv2.c: log version number when starting daenon * CHANGES: remove expired spaces * dpm/dpm_main.c, dpm/dpm_mysql_ifce.c, dpm/dpm_oracle_ifce.pc, h/dpm_server.h: add method dpm_list_expired_spaces and remove expired spaces * project/: e-c_LCG-DM-common.ini, e-c_LCG-DM-dpm-mysql.ini, e-c_LCG-DM-dpm-oracle.ini, e-c_LCG-DM-lfc-mysql.ini, e-c_LCG-DM-lfc-oracle.ini, e-m_LCG-DM-common.ini, e-m_LCG-DM-dpm-mysql.ini, e-m_LCG-DM-dpm-oracle.ini, e-m_LCG-DM-lfc-mysql.ini, e-m_LCG-DM-lfc-oracle.ini: Back to monolithic ETICS build: if PROC_INIT is set, then also the Oracle RPMs are built. If it is not set then only the common part and the MySQL servers are built. * test/dpm/globalSuite: Tuning for new info system. GG. * test/srmv2.2/srm2_testPing.c: Allow for 0 return status even if there NO 'other info' to display. GG. * CHANGES: fix GGUS ticket 21767 * dpm/dpm_errmsg.c, dpm/dpm_seterrbuf.man, ns/Cns_errmsg.c, ns/Cns_seterrbuf.man: protect routines against too small buffers (GGUS 21767) * DPM.spec, LFC.spec: add support for ping and getifcevers methods * test/srmv2.2/srm2_testPing.c: print otherInfo when not NULL * CHANGES: more changes before tagging 1.6.5 * VERSION: version 1.6.5 * dpm/dpm_proclreq.c: if put request issued by root (not for replication), store the file on disk in sub-directory "root" instead of "0" * common/isTrustedHost.c: split into 2 functions isTrustedHost and isTrustedHost2 (needed for DSI plugin) * test/dpm/globalSuite: Improve Gfal testing (srmv2.2 case). Improve hiding of dummy/discover suite steps. GG. * rfio/: rfio_callhandlers.c, rfio_calls.c: correct processing of rfio_access on DPM TURLs * dpm/dpm_main.c, dpm/dpm_procreq.c, ns/Cns_main.c, ns/Cns_procreq.c: add support for ping method * h/Imakefile: add rule to generate patchlevel.h (used by ping and getifcevers methods) * h/patchlevel.in: Initial release * h/: Cns.h, dpm.h: define constants for PING method * Imakefile: change sub-directory order to generate first patchlevel.h * srmv2.2/srmv2_discovreq.c: return DPM version in otherInfo field of the srmPing response * dpm/dpm-shutdown.c: take "server" parameter into account * dpm/send2dpm.c: change argument list to pass host (needed for shutdown and ping) * h/: Cns_api.h, dpns_api.h, lfc_api.h: add prototype for new methods ping and getifcevers * h/dpm_api.h: add prototypes for new methods ping and getifcevers change prototype of send2dpm to pass host as argument (needed for shutdown and ping) * dpm/Imakefile, ns/Imakefile.dpns, ns/Imakefile.lfc: add rules for new methods ping and getifcevers * dpm/dpm_getifcevers.c, dpm/dpm_getifcevers.man, ns/Cns_getifcevers.c, ns/Cns_getifcevers.man: Initial release * dpm/dpm-ping.c, dpm/dpm-ping.man, dpm/dpm_ping.c, dpm/dpm_ping.man, ns/Cns_ping.c, ns/Cns_ping.man, ns/nsping.c, ns/nsping.man: Initial release * project/Makefile.etics: hard-wire the /opt/lcg location for DPMCONFIG * project/Makefile.etics: hard-wire the /opt/lcg location for NSCONFIG * project/Makefile.etics, scripts/get-platform-os: fixing bug#25516: slc4 packages should have a different name * CHANGES: fix bugs 25810 and 25830 * srmv2.2/srmv2_spacereq.c: add ACLs on disk pools * common/Cgroupsubr.c: correctly compute nbgids * common/u64subr.c, h/u64subr.h: add routine u64tostrsi to display values in power of 10 * h/: dpm.h, dpm_server.h, dpm_struct.h: add ACLs on disk pools * dpm/: dpm-qryconf.c, dpm-qryconf.man: add ACLs on disk pools add option --group to display groupnames instead of gids add option --proto to display supported protocols add option --si to display sizes in power of 10 * dpm/: dpm_getpools.c, dpm_modifypool.c, send2dpm.c, dpm-modifypool.c, dpm_addpool.c, dpm_addpool.man, dpm_getpools.man, dpm_modifypool.man, dpm_mysql_ifce.c, dpm_oracle_ifce.pc, dpm_procreq.c, poolmgr.c, dpm-addpool.c, dpm-addpool.man, dpm-modifypool.man: add ACLs on disk pools * test/srmv2.2/: srmv2Stress, srmv2Suite: Small improvement in srmv2Stress. Recursive Rmdir in srmv2Suite. GG. * test/srmv2.2/: srm2_testLs.c, srm2_testRmdir.c: Fix in testLs. Recursive option in testRmdir. GG. * test/srmv2/: srm2_testLs.c, srm2_testMv.c, srm2_testRmdir.c: Fix the storageSystemInfo pointer issue for SLC4/64bit. GG. * scripts/CheckMigrationScript/src/: Makefile, check_main.c, check_migration.c: better handling of the error message * scripts/CheckMigrationScript/readme: instructions on how to use the application * scripts/CheckMigrationScript/src/check_migration.c: remove printf * scripts/UpdateDomainName/output/config_file.dat: wrong param file * scripts/Migration-LFC-MySQL-Oracle/output/config_file.dat: wrong param in the file * scripts/CheckMigrationScript/output/connexion_param.txt: file which contains the DB param * scripts/CheckMigrationScript/include/: check_migration.h, getError.h, list_tab.h: include files for the dpm upgrade check * scripts/: CheckMigrationScript/src/Makefile, CheckMigrationScript/src/check_main.c, CheckMigrationScript/src/check_migration.c, Migration-LFC-MySQL-Oracle/output/config_file.dat, UpdateDomainName/output/config_file.dat, UpdateDomainName/src/Makefile: source files to check that the dpm upgrade to 1.6.3 * srmv2.2/srmv2_dirreq.c: implement recursive srmLs and srmRmdir * CHANGES, VERSION, project/e-c_LCG-DM.ini: release candidate: gl_1_6_4_rc3 * scripts/Migration-LFC-MySQL-Oracle/src/: Makefile, MigrationStmt.cpp: independent of the coloumn order * project/Makefile.etics: enabling custom RPM RELEASE suffixes * srmv2.2/srmv2_xferreq.c: avoid garbage in "protocol" field of a PrepareToGet DB entry when first protocol in the list is not valid * ns/Cns_readdir.c: fix crash (wrong variable name used) * dpm/Imakefile, ns/Imakefile, ns/Imakefile.lfc, srmv1/Imakefile, srmv2/Imakefile, srmv2.2/Imakefile: On x86_64 MySQL and Swig shared libraries are in lib64, instead of lib. * scripts/UpdateDomainName/src/Makefile: error in the log file * test/srmv2.2/: srm2_testLs.c, srm2_testMkdir.c, srm2_testMv.c, srm2_testPut.c, srm2_testPutDone.c: Added CGSI_OPT_DELEG_FLAG to GFAL_SECURE sequence for BestMan tests. To be improved. GG. * project/e-c_LCG-DM.ini: hardwired lcgdm-mapfile, no need for compile any more * project/Makefile.etics: hard-wire the /opt/lcg location for lcgdm-mapfile * test/: dpm/globalSuite, srmv2.2/srmv2Suite: Implementing GridFTP 2 test case. Improving UpdateSpace management as well. GG. * project/e-c_LCG-DM.ini: prefix=/opt/lcg during compilation, that the default location of $(prefix)/etc/lcgdm-mapfile would be right * project/: Makefile.etics, e-c_LCG-DM.ini: back to monolithic * project/: e-c_LCG-DM-common.ini, e-c_LCG-DM-dpm-mysql.ini, e-c_LCG-DM-dpm-oracle.ini, e-c_LCG-DM-lfc-mysql.ini, e-c_LCG-DM-lfc-oracle.ini: last shot, before remove * CHANGES, VERSION: release candidate: gl_1_6_4_rc2 * dpm/poolmgr.c: fix garbage collector thresholds checks (was not working if pool free space was negative, i.e. pool space overcommitted) * test/python/lfc/lfc-perf-symlinks-matrix.pl: Structural improvement with the 'createMatrix' subroutine * test/python/lfc/lfc-perf-symlinks-matrix.pl: Create TSV matrix files also for RTT (Round Trip Time) and commands operating on 1 folder or file * ns/: dpnsdaemon.scripts.mysql, dpnsdaemon.scripts.oracle, dpnsdaemon.sysconfig.mysql, dpnsdaemon.sysconfig.oracle, lfcdaemon.scripts.mysql, lfcdaemon.scripts.oracle, lfcdaemon.sysconfig.mysql, lfcdaemon.sysconfig.oracle: Removed GRIDMAP and GRIDMAPDIR variables from sysconfig and init.d files (for LFC and DPNS). 2007-03-27 10:58 slemaitr - Before 1.6.4: * CHANGES: Added database migration scripts for DPM secondary groups support. * dpm/: dpm_mysql_tbl.sql, dpm_oracle_tbl.sql: Changes for DPM secondary groups support. * scripts/dpm-secondary-groups/: UpdateDpmDatabase.pm, dpm_secondary_groups: Adding "groups" column in "dpm_pool" table, and populating it from the "gid" column. Deleting the "gid" column from "dpm_pool". * ns/: Cns_mysql_tbl.sql, Cns_oracle_tbl.sql: Coming back to schema_version instead of schema_version_cns. Coming back to 3.0.0 instead of 3.1.0. * CHANGES: change in srmMv behaviour * test/srmv2.2/: srm2_testMv.c, srmv2Suite: Implement Mv File towards Dir test. GG. * srmv2.2/srmv2_dirreq.c: allow in srmMv to move a file to another directory giving the directory name as target * DPM.spec: Added warning for 1.6.4 migration script to be run. * test/dpm/globalSuite: Improving rfio/gsiftp Suite tests for lxb1903 special case. GG. * CHANGES: bug 23051 is also fixed * CHANGES: adding changes since 1.6.3 * dpm/poolmgr.c: If the free space in a pool or filesystem was already negative, it was still possible to reserve space * test/python/lfc/atlas/atlas-lfc-perf-symlinks-hosts.pl: glite-job-submit does NOT support the '--valid' option anymore * test/python/lfc/lfc-perf-symlinks.sh: Add display of BDII (value of the 'LCG_GFAL_INFOSYS' environment variable * Makefile.etics, project/Makefile.etics, project/e-c_LCG-DM-common.ini, project/e-c_LCG-DM-dpm-mysql.ini, project/e-c_LCG-DM-dpm-oracle.ini, project/e-c_LCG-DM-lfc-mysql.ini, project/e-c_LCG-DM-lfc-oracle.ini, project/e-c_LCG-DM.ini, project/e-m_LCG-DM-common.ini, project/e-m_LCG-DM-dpm-mysql.ini, project/e-m_LCG-DM-dpm-oracle.ini, project/e-m_LCG-DM-lfc-mysql.ini, project/e-m_LCG-DM-lfc-oracle.ini, project/e-m_LCG-DM.ini, project/etics-configuration-template.ini: Split the build into 5 ETICS components to allow building non-oracle parts only. * security/Imakefile: Create libdir in the install target before installing files in it! * project/: e-c_LCG-DM-dpm-mysql.ini, e-c_LCG-DM-dpm-oracle.ini, e-c_LCG-DM-lfc-mysql.ini, e-c_LCG-DM-lfc-oracle.ini, e-c_LCG-DM.ini: turned runtime deps into build deps * project/Makefile.etics: [no log message] * project/: Makefile.etics, e-c_LCG-DM-dpm-mysql.ini, e-c_LCG-DM-dpm-oracle.ini, e-c_LCG-DM-lfc-mysql.ini, e-c_LCG-DM-lfc-oracle.ini, e-c_LCG-DM.ini, e-m_LCG-DM-common.ini, e-m_LCG-DM-dpm-mysql.ini, e-m_LCG-DM-dpm-oracle.ini, e-m_LCG-DM-lfc-mysql.ini, e-m_LCG-DM-lfc-oracle.ini: refactoring is being finished * dpm/: dpm_mysql_ifce.c, dpm_oracle_ifce.pc: add support for new DB schema needed for ACLs on pools * project/e-c_LCG-DM-common.ini: https://savannah.cern.ch/bugs/?24942 * project/: e-c_LCG-DM-common.ini, e-m_LCG-DM-common.ini: common component * project/e-m_LCG-DM.ini: updated doc location * project/: Makefile.etics: explicit check for proc * Makefile.etics, VERSION, config/site.def, project/Makefile.etics, project/e-c_LCG-DM.ini, project/e-m_LCG-DM.ini, project/etics-configuration-template.ini, security/Imakefile: splitting up LCG-DM ETICS configuration into five pieces * project/Makefile.etics: half way * h/dpm_constants.h: fix bug 24755: dpm-modifypool --help" segfaults in DPM 1.6.3 * srmv2.2/srm_util.c, srmv2.2/srmv2_permreq.c, srmv2.2/srmv2_spacereq.c, srmv2.2/srmv2_xferreq.c, DPM.spec, LFC.spec: add support for secondary groups * srmv2.2/srmv2_dirreq.c: add support for secondary groups report fileLocality in srmLs output * srmv2/: srm_util.c, srmv2_dirreq.c, srmv2_permreq.c, srmv2_spacereq.c, srmv2_xferreq.c: add support for secondary groups * srmv1/: srm_util.c, srmv1_procreq.c: add support for secondary groups * ns/: Cns_acl.c, Cns_chkperm.c, Cns_main.c, Cns_procreq.c, Imakefile.dpns, Imakefile.lfc, send2nsd.c, sendrep.c: add support for secondary groups * project/Makefile.etics: file Makefile.etics was added on branch LCG-DM_branch_1_6_3 on 2007-03-21 17:00:52 +0000 * Makefile.etics, project/Makefile.etics, project/e-c_LCG-DM.ini: moved Makefile.etics into the project subdirectory * project/e-c_LCG-DM.ini: file e-c_LCG-DM.ini was added on branch LCG-DM_branch_1_6_3 on 2007-03-21 17:00:52 +0000 * project/e-m_LCG-DM.ini: file e-m_LCG-DM.ini was added on branch LCG-DM_branch_1_6_3 on 2007-03-21 17:00:52 +0000 * project/: e-c_LCG-DM.ini, e-m_LCG-DM.ini, etics-configuration-template.ini: preparation for creating multiple ETICS configurations for the same component * ns/: Cns_getgrpbygids.c, Cns_getgrpbygids.man: Initial release (to support secondary groups) * h/: Cns.h, Cns_api.h, Cns_server.h, dpm.h, dpm_server.h, srm_server.h: add support for secondary groups * dpm/dpm_procreq.c: add support for secondary groups return an error if attempt to extend lifetime of an already expired TURL * dpm/: dpm_main.c, dpm_mysql_ifce.c, dpm_oracle_ifce.pc, dpm_proclreq.c: add support for secondary groups * common/Imakefile: add rule for Cgroupsubr * common/Cgroupsubr.c: Initial release (to support secondary groups) * test/srmv2.2/srmv2Suite: Implement additional ExtendFileLifetime test for EXPIRED TURLs. GG. * test/srmv2.2/srm2_testExtendFileLifeTime.c: Improve status output. GG. * project/build.properties: explicit dependency on gSOAP 2.6.2 * socket/: dpmcli/dpm-extendfilelife.c, dpmcli/dpm-get.c, dpmcli/dpm-getreqid.c, dpmcli/dpm-put.c, dpmcli/dpm-putdone.c, dpmcli/dpm-relfiles.c, dpmcli/dpm-resp.c, dpmcli/dpm-rlsp.c, dpmcli/dpm-upsp.c, goputils/gop_outp.c: Improve SLC4/32bit compatibility. GG. * test/: dpm/globalSuite, srmv2.2/srmv2Suite: Implement more cert and VOs possibilities. GG. * test/srmv2.2/srm2_testLs.c: Implement fileLocality output option. GG. * test/python/lfc/atlas/atlas-lfc-hosts.txt: Italy : LFC host name is now 'lfc.cr.cnaf.infn.it' * dpm/dpm_util.c: remove extra newline when logging error statuses * DPM.spec: Adding the DPM secondary groups script to the RPM. * DPM-interfaces.spec, LFC-interfaces.spec: Perl 5 is required (but not specifically Perl 5.8). * scripts/dpm-secondary-groups/UpdateDpmDatabase.pm: We keep schema_version, and only create schema_version_dpm. * scripts/cns-migrate-schema-to-3-1-0/: migrate-mysql-schema-to-3-1-0.sql, migrate-oracle-schema-to-3-1-0.sql: No need to change the cns_db schema version. * scripts/lfc-secondary-groups/: migrate-mysql-schema-to-3-1-0.sql, migrate-oracle-schema-to-3-1-0.sql: Changing to another directory. * scripts/cns-migrate-schema-to-3-1-0/: migrate-mysql-schema-to-3-1-0.sql, migrate-oracle-schema-to-3-1-0.sql: Changing directory, not to refer to secondary groups for LFC. * scripts/lfc-secondary-groups/: Common.pm, README, UpdateLfcDatabase.pm, lfc_secondary_groups: Using directly SQL scripts instead. * scripts/lfc-secondary-groups/: migrate-mysql-schema-to-3-1-0.sql, migrate-oracle-schema-to-3-1-0.sql: [no log message] * scripts/lfc-secondary-groups/: Common.pm, README, UpdateLfcDatabase.pm, lfc_secondary_groups: Changing schema_version into schema_version_cns. * scripts/dpm-secondary-groups/: Common.pm, UpdateDpmDatabase.pm, dpm_secondary_groups: No need for cast() or to_char(). * dpm/dpm_mysql_tbl.sql, dpm/dpm_oracle_tbl.sql, ns/Cns_mysql_tbl.sql, ns/Cns_oracle_tbl.sql: Upgrading schema version to 3.1.0. Changing schema_version into schema_version_cns and schema_version_dpm. * scripts/dpm-secondary-groups/UpdateDpmDatabase.pm: Right names at the right place. * scripts/dpm-secondary-groups/dpm_secondary_groups: forgot something. * scripts/dpm-secondary-groups/dpm_secondary_groups: 'groups' field updated differently if MySQL or Oracle. * scripts/dpm-secondary-groups/: UpdateDpmDatabase.pm, dpm_secondary_groups: To ease deployment, changed schema_version into schema_version_cns and schema_version_dpm. * scripts/dpm-secondary-groups/: Common.pm, README, UpdateDpmDatabase.pm, dpm_secondary_groups: Adding script that update the "dpm_db" database schema for secondary groups support. * ns/Cns_oracle_tbl.sql: Added missing ";" * ns/Cns_oracle_tbl.sql: Removed "DROP TABLE schema_version". * LFC.spec: Added the Perl/Python interfaces tests to the LFC-client RPM. * ns/Cns_getidmap.man: correct function prototype * ns/lfc_perl.man: Changed man page to use the new SWIG way of programming. * test/python/lfc/UI_validation_tests.py: User Interface validation tests (for the UI admins). * test/perl/UI_validation_tests.pl: Moving to lfc/ subdirectory. * test/perl/lfc/UI_validation_tests.pl: User Interface validation test (for the UI admins). * test/perl/UI_validation_tests.pl: Addind a test for Grid User Interface validation (by the UI administrators). * srmv2.2/srmv2_spacereq.c: fix logging of statusCode in srmPurgeFromSpace * scripts/UpdateACLForMySQL/readme: the readme file which contains the instructions has also been updated * scripts/UpdateACLForMySQL/: include/updateACL_core.h, output/config_file.dat, src/updateACL_core.cpp, src/updateACL_main.cpp: the new script to update acl includes more features * ns/lfc_perl.man: typo. * dpm/dpm.i: Ported the LFC interface to the DPNS, except for lfc_getreplicas. * ns/lfc.i: Added R_OK, W_OK, X_OK and F_OK constants (for lfc_access method). * CHANGES-long: minor update * h/dpm_constants.h: define OPT_S_TOKEN 2007-02-21 05:52 baud - Before 1.6.3 : * h/dpm_constants.h: define OPT_S_TOKEN * scripts/dpm-support-srmv2.2/UpdateDpmDatabase.pm: Cns_file_replica(ltime) is updated for f_type='D' * scripts/dpm-support-srmv2.2/: UpdateDpmDatabase.pm, dpm_support_srmv2.2: dpm_put_filereq(f_lifetime) is updated. * dpm/dpm_main.c, ns/Cns_main.c, rfio/parse.c, rfio/rfio_serv.c, srmv1/srmv1.c, srmv2/srmv2.c, srmv2.2/srmv2.c: add prototypes for Cdomainname() and isTrustedHost() * h/Cuuid.h: not used * dpm/dpm_procreq.c: allow to rename file/directory between PrepareToPut and PutDone * dpm/dpm_main.c: keep dpnshost in global variable (needed for the rename fix in dpm_procreq.c) * srmv2.2/srmv2_spacereq.c: first implementation of srmPurgeFromSpace * test/srmv2.2/: srm2_testExtendFileLifeTime.c, srm2_testExtendFileLifeTimeInSpace.c, srm2_testPurgeFromSpace.c, srm2_testPutDone.c, srmv2Suite: Implementing testPurgeFromSpace + minor fixes. GG. * srmv1/srmv1_procreq.c: fix error reporting in getRequestStatus when failure for all SURLs * srmv2.2/: srmv2_dirreq.c, srmv2_permreq.c: fix test on sfn length * test/python/lfc/: compare-perf.sh, lfc-perf-symlinks-purge-hosts.sh, lfc-perf-symlinks.sh: Select correctly the adequate PYTHON interpreter * test/python/lfc/lfc-perf-symlinks-parselog.pl: For LFC commands on an unique folder or file, automatically detect LFC failures, report them, and exclude the associated data from performance measurements * test/python/lfc/lfc-perf-symlinks.sh: Print a blank line before starting the test of each LFC host * DPM.spec: add rules for dpm-releasespace and dpm-updatespace CLIs * dpm/dpm_procreq.c: add logging for getspacetoken method * dpm/Imakefile: add rules for dpm-releasespace and dpm-updatespace CLIs * dpm/: dpm-reservespace.c, dpm-reservespace.man: add the possibility to enter lifetimes as numbers with suffix * dpm/: dpm-releasespace.c, dpm-releasespace.man, dpm-updatespace.c, dpm-updatespace.man: Initial release * srmv2/srmv2_xferreq.c: log parameters of AbortRequest and GetRequestID * dpm/dpm_proclreq.c, dpm/dpm_procreq.c, dpm/dpm_util.c, h/dpm_server.h, h/dpm_util.h, h/srm_server.h, srmv2.2/srmv2_dirreq.c, srmv2.2/srmv2_permreq.c, srmv2.2/srmv2_spacereq.c, srmv2.2/srmv2_xferreq.c: log status codes * srmv2.2/srmv2_dirreq.c: in srmLs: - check for negative count/offset values - return lifetimeLeft, fileStorageType for a file at level 0 * test/: dpm/globalSuite, srmv2.2/srmv2Suite: Inserted more testLs cases in srmv2Suite + special case in globalSuite.GG. * Makefile.etics: source RPMs * test/python/lfc/lfc-rm-symlinks-of-dir-reverse.py: Line 70: Remove extraneous '.' * scripts/migrate-oracle-schema-to-2-3-0.sql: Added a warning: this script was made for testing the materialized views replication. 2007-02-05 10:35 slemaitr - Before 1.6.2 : * scripts/: dpm-support-srmv2.2/UpdateDpmDatabase.pm, lfc-support-1.6.0/migrate-mysql-schema-to-3-0-0.sql, lfc-support-1.6.0/migrate-oracle-schema-to-3-0-0.sql: Cns_file_metadata(name) changed from 231 to 255 varchar. * VERSION: release 1.6.1-2 * ns/: send2nsd.c, sendrep.c: backported #22432 fixes to the 1.6.1 branch * srmv1/srmv1_procreq.c: fix status of setFileStatus to "Done" when executed on an expired file * srmv2.2/srmv2_xferreq.c: fix file status when ExtendFileLifeTime on expired, released or aborted file modify response of GetRequestSummary to be compliant to SRM BOF decisions * srmv2/srmv2_xferreq.c: fix file status when ExtendFileLifeTime on expired, released or aborted file * h/: Castor_limits.h, Castor_limits.man: increase maximum length of filename components to 255 * ns/: sendrep.c, send2nsd.c: add support for method getreplicas (bug 22432) * ns/Cns_chkperm.c: add check on basename length * ns/: Cns_mysql_tbl.sql, Cns_oracle_tbl.sql: increase maximum length of filename components to 255 * ns/Cns_mysql_ifce.c: allow special characters in replicas and links implement in software the "unique" constraint on replicas as replicas can be longer that the MySQL limit * dpm/dpm_proclreq.c: allow basenames up to 255 characters long * dpm/dpm_mysql_ifce.c: add support for special characters in surls and pfns * dpm/: dpm_extendfilelife.c, dpm_putdone.c: fix return code if DPM_RELEASED, DPM_ABORTED or DPM_EXPIRED * scripts/change-se-name/update-LFC-after-SE-renamed.pl: Was checking oldSE/newSE instead of oldPath/newPath... * scripts/lfc-support-1.6.0/migrate-mysql-schema-to-3-0-0.sql: Replacing unique constraint on Cns_file_replica(sfn) by a index. * scripts/dpm-support-srmv2.2/: Common.pm, UpdateDpmDatabase.pm: More robust. * scripts/dpm-support-srmv2.2/: Common.pm, UpdateDpmDatabase.pm, dpm_support_srmv2.2: DEFPINTIME in dpm_pool is updated to 7200s if equals to 0. * scripts/dpm-support-srmv2.2/UpdateDpmDatabase.pm: Replacing UNIQUE(sfn(255)) constraint by INDEX(sfn) in Cns_file_replica. * ns/Cns_mysql_tbl.sql: Specifying the length of sfn (BLOB) for the INDEX creation. * ns/Cns_lstat.man: Adding Cns_lstat.man as a link to Cns_stat.man * CHANGES: fixed bug #23222 * DPM-interfaces.spec, DPM-oracle.spec, DPM.spec, LFC-interfaces.spec, LFC-oracle.spec, LFC.spec: relaxing the strict dependencies among the DPM/LFC components * scripts/UpdateACLForMySQL/src/: updateACL_core.cpp, updateACL_main.cpp: better error report * LFC.spec, ns/Imakefile.lfc: Added lfc_stat, lfc_lstat, lfc_delete and lfc_undelete man pages to RPM. * ns/Imakefile.dpns, DPM.spec: Added dpns_lstat, dpns_delete and dpns_undelete man pages to RPM. * security/Csec_plugin_GSS.c: Using VOMS_ErrorMessage() to retrieve detailed error messages, if VOMS_Retrieve() fails. * security/Csec_common.c: buffering of print_token. * scripts/UpdateACLForMySQL/src/updateACL_main.cpp: inversion between owner uid and gid * srmv2.2/srmv2_xferreq.c: set default value for the overwrite flag to NEVER * srmv2/srmv2_dirreq.c: in srmLs: correctly support symbolic links * srmv2.2/srmv2_dirreq.c: in srmLs: correctly support symbolic links, support offset/count, report fileStorageType and lifetimeLeft when nblevels == 0 * test/srmv2.2/: srm2_testLs.c, srmv2Stress, srmv2Suite: srmLs (offset + count) and long SURL name (<=255) improvements. GG. * ns/Cns_mysql_tbl.sql: Replaced UNIQUE(sfn(255)) constraint by INDEX(sfn). * test/python/lfc/atlas/: lfc-perf-atlas-dq2-ddmf1-ddmf1.001099.Argon.global.ESD.v000211.sh, lfc-perf-atlas-dq2-ddmf1.sh: export LFC_HOST=lxb1540.cern.ch - Add test of the 'lfc-readdirg-recurse-grs.py' script using the 'lfc_getreplicas' method * test/python/lfc/lfc-readdirg-recurse-grs.py: For the folder given as parameter, this script recursively lists the files and their replicas with optimized performance. It uses the lfc_opendirg, lfc_readdirg and lfc_getreplicas methods. * test/python/lfc/lfc-readdirg-grs.py: For the folder given as parameter, this script lists the files, their mode, their size and their replicas with optimized performance. It uses the lfc_opendirg, lfc_readdirg and lfc_getreplicas methods. * scripts/UpdateDomainName/output/config_file.dat: file where the input param are stored * scripts/UpdateDomainName/src/getError.cpp: source file to handle errors * scripts/UpdateDomainName/src/Makefile: makefile * scripts/UpdateDomainName/src/: update_domain_core.cpp, update_main.cpp: source files * scripts/UpdateDomainName/include/: getError.h, update_domain_core.h: header files of the update domain application * scripts/UpdateACLForMySQL/src/updateACL_main.cpp: the autocommit is called in the main * scripts/UpdateACLForMySQL/src/updateACL_core.cpp: forgot to release a buffer * test/python/lfc/lfc-perf-symlinks-matrix.pl: Robustness : Add detection of LFC failures : Display their number and exclude the associated data from performance measurements * test/python/lfc/lfc-perf-symlinks-parselog.pl: Robustness : Take into account the number of files really processed in order to detect of LFC failures - Report LFC failures in 'lfc-perf-symlinks.error.tsv' * test/python/lfc/lfc-perf-symlinks.jdl.template: Add 'lfc-perf-symlinks.error.tsv' to OutputSandbox * test/python/lfc/lfc-perf-symlinks.sh: Robustness : Improve messages - Log LFC errors to $LOGFILE.error.tsv * project/etics-configuration-template.ini: ETICS: voms-api and voms-api-c are installed in stage, even if they were binary deps. * CHANGES: Database schema migration scripts for 1.6 support * DPM-oracle.spec, DPM.spec: 755 permissions on dpm_support_srmv2.2 * DPM-oracle.spec, DPM.spec: Added the migration script to the RPM as well... * LFC-oracle.spec, LFC.spec: Added LFC DB migration scripts to spec files. * scripts/lfc-support-1.6.0/: migr_cns_db_mysql_1.6, migr_cns_db_oracle_1.6: File renamed. * scripts/lfc-support-1.6.0/: migrate-mysql-schema-to-3-0-0.sql, migrate-oracle-schema-to-3-0-0.sql: Renamed the schema migration scripts. * scripts/lfc-support-1.6.0/: migr_cns_db_mysql_1.6, migr_cns_db_oracle_1.6: The schema_version number is upgraded to 3.0.0 now. * DPM-oracle.spec, DPM.spec: Added SRMv2.2 migration scripts - that modify the DPNS and DPM schema, and updates the database as needed. * scripts/dpm-support-srmv2.2/UpdateDpmDatabase.pm: Added the possible missing indexes * scripts/UpdateACLForMySQL/readme: readme of the application * scripts/UpdateACLForMySQL/output/config_file.dat: the config file which contains input param * scripts/UpdateACLForMySQL/include/: getError.h, updateACL_core.h: header files * scripts/UpdateACLForMySQL/src/Makefile_bis: makefile for a dynamic executable * scripts/UpdateACLForMySQL/src/Makefile: makefile for a static executable * scripts/UpdateACLForMySQL/src/: getError.cpp, updateACL_core.cpp, updateACL_main.cpp: source files to update the ACL for the directories * DPM-interfaces.spec, DPM-oracle.spec, DPM.spec, Imakefile, LFC-interfaces.spec, LFC-oracle.spec, LFC.spec, Makefile.etics, VERSION, lcg-dm-common.spec: RPM release number can be set. * CHANGES: documenting the VO name length check fix * project/etics-configuration-template.ini: etics configuration template * Makefile.etics, build.xml, scripts/proc, scripts/proc-init-cern-afs: ETICS style build * DPM-interfaces.spec, DPM-oracle.spec, DPM.spec, Imakefile, LFC-interfaces.spec, LFC-oracle.spec, LFC.spec, VERSION, lcg-dm-common.spec: enabling release in builds * dpm/dpm_util.c: back-ported from 1.6.0: fix processing of DPM PROTOCOLS entry from shift.conf * security/Csec_api.c: back-ported from v1.6.1: fix check on voname length (GGUS 16579) * security/Csec_api.c: fix check on voname length (GGUS 16579) * project/etics-configuration-template.ini: corrected VOMS dependencies * project/etics-configuration-template.ini: file etics-configuration-template.ini was added on branch LCG-DM_branch_1_5_10 on 2007-01-18 21:29:46 +0000 * test/python/lfc/: lfc-perf-symlinks-parselog.pl, lfc-perf-symlinks.sh: Report also the gLite version * project/etics-configuration-template.ini: proper voms location * project/etics-configuration-template.ini: swig goes back to default platform dependency * test/: dpm/globalSuite, srmv1/srmv1Suite, srmv2.2/parsesurl.ic, srmv2.2/srm2_testAbortFiles.c, srmv2.2/srm2_testGetPermission.c, srmv2.2/srm2_testLs.c, srmv2.2/srm2_testPut.c, srmv2.2/srm2_testReleaseSpace.c, srmv2.2/srm2_testUpdateSpace.c, srmv2.2/srmv2Suite: Fixes for DPM 1.6.1. GG. 2007-01-17 11:54 baud - Before tagging 1.6.1 : * VERSION: upgrading to 1.6.1 * ns/lfc.i: add support for lfc_getreplicas method * LFC.spec: add support for lfc_getreplicas * dpm/dpm_updatespace.man: any numeric value set to -1 is unchanged in the server * dpm/dpm-qryconf.man: document the need to specify environment variable DPM_HOST * dpm/Imakefile: add better dependencies for swig interface file * h/dpns_api.h: add support for method readdir64() * h/: Cns_api.h, lfc_api.h: add support for methods getreplicas() and readdir64() * h/Cns.h: add support for method getreplicas() * ns/Imakefile.lfc: add rules for method lfc_getreplicas add better dependencies for swig interface file * ns/Cns_readdir.c: add method Cns_readdir64 * ns/: Cns_main.c, Cns_procreq.c: add support for method getreplicas (bug 22432) * ns/: Cns_getreplicas.c, Cns_getreplicas.man: Initial release * dpm/dpm_proclreq.c, dpm/dpm_procreq.c, srmv1/srmv1_procreq.c, srmv2/srmv2.c, srmv2/srmv2_xferreq.c, srmv2.2/srmv2.c, srmv2.2/srmv2_dirreq.c, srmv2.2/srmv2_spacereq.c, srmv2.2/srmv2_xferreq.c: return NOT_SUPPORTED instead of INVALID_REQUEST if protocol not supported return FAILURE if request failed for all sub-requests add a detailed error message "Failed for all ... " * scripts/proc-init-cern-afs: Oracle.Support@cern.ch has fixed the sys-include path on SLC4 in this version. * ns/: nschown.c, nschown.man: allow to change the group keeping the owner unchanged (bug 22853) * DPM.spec, LFC.spec: add rules for new chgrp CLI (bug 22853) * ns/: Imakefile.cns, Imakefile.dpns, Imakefile.lfc: add rules for new chgrp CLI (bug 22853) * dpm/dpm_procreq.c: avoid crash in abortfiles on a file in a state not "putdone" in updatespace, if a parameter is not given, do not update the corresponding field * srmv2/srmv2_spacereq.c, srmv2.2/srmv2_spacereq.c: in UpdateSpace, if a parameter is not given, do not update the corresponding field * ns/: nschgrp.c, nschgrp.man: Initial release * srmv2/srmv2_xferreq.c, srmv2.2/srmv2_xferreq.c: return filestatuses in srmAbortFiles even if the request failed for all SURLs * scripts/choose-module: do not change locations in choose-module! * dli/dli.c, srmv1/srmv1.c, srmv2/srmv2.c, srmv2.2/srmv2.c: log soap_serve errors like VOMS errors * dpm/dpm_oracle_ifce.pc: remove extra CONTEXT FREE which was suppressing the Oracle error description * srmv2/srmv2_dirreq.c, srmv2.2/srmv2_dirreq.c: set default number of levels for srmLs to 1 (instead of 0) to be consistent with FNAL and Unix ls * scripts/dpm-support-srmv2.2/: UpdateDpmDatabase.pm, dpm_support_srmv2.2: Updating the schema version. Put the column DROPs at the end of the script. * dpm/: dpm-addfs.man, dpm-addpool.man, dpm-drain.man, dpm-modifyfs.man, dpm-modifypool.man, dpm-replicate.man, dpm-reservespace.man, dpm-rmfs.man, dpm-rmpool.man: add option --help (GGUS 11225) more informative man pages for dpm-drain, dpm-qryconf, dpm_modifyfs (GGUS 11225) * dpm/: dpm-addfs.c, dpm-addpool.c, dpm-drain.c, dpm-modifyfs.c, dpm-modifypool.c, dpm-replicate.c, dpm-reservespace.c, dpm-rmfs.c, dpm-rmpool.c: add option --help (GGUS 11225) * scripts/dpm-support-srmv2.2/UpdateDpmDatabase.pm: Fixed typo. * scripts/dpm-support-srmv2.2/UpdateDpmDatabase.pm: Deleting the copy requests, as copy is not supported yet. Updating Cns_file_replica(ltime) for volatile files as well. Updating schema version. * rfio/rfmkdir.c: a) correctly set permissions if parent directories have default ACLs (bug 18490) b) if error, continue with next file c) accept existing directories if option -p * h/Cns_api.h: suppress prototype for Cns_setltime() and add prototype for Cns_setrltime() * srmv2.2/srmv2_xferreq.c: fix to process correctly null targetFileRetentionPolicyInfo in PrepareToGet, BringOnline, PrepareToPut and Copy * dpm/poolmgr.c: make SRM 2.2 reservespace work when there are only Permanent and Volatile pools * scripts/dpm-support-srmv2.2/: UpdateDpmDatabase.pm, dpm_support_srmv2.2: Added the schema changes for the DPM and DPNS databases. * test/: Imakefile, srmv1/Imakefile, srmv2/Imakefile, srmv2.2/Imakefile: Moving to the new setup for GSOAP_LOCATION. GG. * test/srmv2.2/srmv2Suite: Small fix (comparison). GG. * test/srmv2.2/: srm2_testExtendFileLifeTimeInSpace.c, srmv2Suite: Implement ExtendFileLifeTimeInSpace test sequence in srmv2Suite. GG. * CHANGES: bug 19575 is also fixed * CHANGES, CHANGES-long: 1.6.0 release 2006-12-22 10:01 baud - Before tagging 1.6.0 : * srmv2.2/srmv2_spacereq.c: fix server crash in srmExtendFileLifeTimeInSpace * scripts/choose-module: add support for SRM 2.2 * DPM-oracle.spec, DPM.spec: add support for SRM 2.2 * test/: srmv2/srm2_testGetRequestID.c, srmv2.2/srm2_testGet.c, srmv2.2/srm2_testGetRequestStatus.c, srmv2.2/srmv2Suite: Mainly: implement pinTime into testGet client. GG. * config/Library.tmpl: add support for SRM 2.2 * config/: Project.tmpl, site.def: add support for SRM 2.2 * VERSION: upgrading to 1.6.0 * LFC.spec: add man pages for lfc_addreplicax, lfc_getreplicax, lfc_listrepset, lfc_setrltime * Imakefile: add rules for SRM 2.2 * dpm/poolmgr.c: stop GC when pool removed handle default and max lifetimes/pintimes add support for SRM 2.2 features fix pool selection (bug 20594) * dpm/dpm_procsubr.c: add support for v2.2 flavour of getreqsummary correct processing of pintime for relfiles/ReleaseFiles * dpm/dpm_procreq.c: add support for new (SRM 2.2) DB schema reallocate space for reservespace requests at DPM startup time set correctly the statuses RELEASED and ABORTED correctly handle lifetime and pintime add support for SURL lifetime extension return SEOPNOTSUPP for dpm_copy requests add support for SRM 2.2 flavour of getreqsummary reject dpm_relfiles on dpm_put requests correctly update unused space in space metadata * dpm/dpm_proclreq.c: add support for new (SRM 2.2) DB schema add support for srmBringOnline and ret_policy in put requests correctly handle lifetime and pintime generate correct path for disk file when replicating as root (GGUS 14795) remove name space entry if failure during TURL generation * dpm/dpm_oracle_tbl.sql: new DB schema (SRM 2.2) * dpm/dpm_mysql_tbl.sql: new DB schema (SRM 2.2 and negative unused space) * dpm/dpm_oracle_ifce.pc: add support for new DB schema (SRM 2.2) suppress routine dpm_get_max_put_lifetime add routine dpm_list_spcmd_entry add support for null user description in dpm_getreqid and dpm_getspacetoken * dpm/dpm_mysql_ifce.c: add support for new DB schema (SRM 2.2 and negative unused space) suppress routine dpm_get_max_put_lifetime add routine dpm_list_spcmd_entry add support for null user description in dpm_getreqid and dpm_getspacetoken fix for bug 20595 (DPM server crash when reconnecting to MySQL) * dpm/dpm_main.c: stop GC if pool removed add support sor SRM 2.2 (files in spaces) * dpm/dpm-qryconf.man: document support fro SRM 2.2 features * dpm/dpm-qryconf.c: add support for SRM 2.2 features fix bug 20768 (negative free space) * dpm/: dpm_reservespace.c, dpm_reservespace.man, send2dpm.c: add support for SRM 2.2 features * dpm/: dpm_getstatus_putreq.c, dpm_getstatus_putreq.man: dpm_put handles both pintime and file lifetime (SRM 2.2) * dpm/dpm_getstatus_copyreq.man: dpm_copy handles f_lifetime and not pintime * dpm/dpm_getspacetoken.man: document support for NULL user description * dpm/: dpm_getpools.c, dpm_getpools.man, dpm_getspacemd.c, dpm_getspacemd.man: add support for SRM 2.2 features * dpm/: dpm_extendfilelife.c, dpm_extendfilelife.man: accept NULL r_token to extend SURL lifetime * dpm/: dpm_copy.c, dpm_copy.man, dpm_get.c, dpm_get.man, dpm_put.c, dpm_put.man: add support for SRM 2.2 features * dpm/: dpm-addpool.c, dpm-addpool.man, dpm-modifypool.c, dpm-modifypool.man, dpm_addpool.c, dpm_addpool.man, dpm_modifypool.c, dpm_modifypool.man: add support for SRM 2.2 * dpm/: dpm-reservespace.c, dpm-reservespace.man: Initial release * dpm/Imakefile: add rules for dpm-reservespace CLI and man page * srmv2/srmv2_xferreq.c: adapt to new (SRM 2.2) DB schema reject srmReleaseFiles on PrepareToPut requests reject srmCopy requests (not supported) * srmv2/srmv2_spacereq.c: fix call to decode_group and decode_user methods adapt to new dpm_reservespace prototype return lifetimeLeft = 0 if space expired * srmv2/srmv2_dirreq.c: fix decode_group and decode_user routines * srmv1/srmv1_procreq.c: add support for new (SRM 2.2) DB schema * test/srmv2.2/srmv2Suite: One more fix. GG. * test/srmv2.2/srmv2Suite: Small fix. GG. * h/dpm_struct.h: add support for SRM 2.2 fix for negative free space (bug 20768) * h/dpm_server.h: add support for SRM 2.2 fix for negative unused space * h/: dpm.h, dpm_api.h, dpm_constants.h: add support for SRM 2.2 * build.xml: complying with gLite customs * build.xml: simplified gLite build procedure using Makefile.etics * srmv2.2/srmv2_xferreq.c: return SRM_NOT_SUPPORTED for srmCopy requests support srmReleaseFiles with NULL array of SURLs * srmv2.2/srmv2_spacereq.c: handle correctly negative unused space in srmGetSpaceMetaData get correctly the default lifetime in srmExtendFileLifeTimeInSpace * socket/: dpmcli/dpm-delreplica.c, dpmcli/dpm-get.c, dpmcli/dpm-gspt.c, dpmcli/dpm-listReplicas.c, dpmcli/dpm-put.c, dpmcli/dpm-putdone.c, dpmcli/dpm-resp.c, dpmcli/dpm-testPutTwo.c, dpmcli/module.mk, goputils/gop_comm.h, goputils/gop_glob.c, goputils/gop_pars.c: Preparing release 1.6.x. GG. * test/: dpm/globalSuite, dpm/socketSuite, srmv2/srm2_testGetRequestID.c, srmv2/srmv2Suite: Preparing release 1.6.x. GG. * test/srmv2.2/: srm2_testAbortFiles.c, srm2_testAbortRequest.c, srm2_testBring.c, srm2_testChangeSpaceForFiles.c, srm2_testCheckPermission.c, srm2_testCopy.c, srm2_testExtendFileLifeTime.c, srm2_testExtendFileLifeTimeInSpace.c, srm2_testGet.c, srm2_testGetPermission.c, srm2_testGetRequestStatus.c, srm2_testGetRequestSummary.c, srm2_testGetRequestTokens.c, srm2_testGetSpaceMetaData.c, srm2_testGetSpaceTokens.c, srm2_testGetTransferProtocols.c, srm2_testLs.c, srm2_testMkdir.c, srm2_testMv.c, srm2_testPing.c, srm2_testPurgeFromSpace.c, srm2_testPut.c, srm2_testPutDone.c, srm2_testReleaseFiles.c, srm2_testReleaseSpace.c, srm2_testReserveSpace.c, srm2_testResumeRequest.c, srm2_testRm.c, parsesurl.ic, soapcallns1.ic, srm.v2.2.wsdl, srm2_testRmdir.c, srm2_testSetPermission.c, srm2_testStatusOfChangeSpaceForFilesRequest.c, srm2_testStatusOfLsRequest.c, srm2_testStatusOfReserveSpaceRequest.c, srm2_testStatusOfUpdateSpaceRequest.c, srm2_testSuspendRequest.c, srm2_testUpdateSpace.c, srmv2Stress, srmv2Suite, typemap.dat: Initial release. GG. * srmv2.2/srmv2.2.scripts.oracle: correct port number * dpm/dpm.scripts.oracle, dpm/dpm.sysconfig, dpm/dpm.sysconfig.oracle, ns/dpnsdaemon.scripts.oracle, ns/dpnsdaemon.sysconfig.oracle, ns/lfcdaemon.scripts.oracle, ns/lfcdaemon.sysconfig.oracle, srmv1/srmv1.scripts.oracle, srmv1/srmv1.sysconfig.oracle, srmv2/srmv2.scripts.oracle, srmv2/srmv2.sysconfig.oracle, srmv2.2/srmv2.2.scripts.oracle, srmv2.2/srmv2.2.sysconfig.oracle: $ORACLE_HOME is now pointing to version 10.2.0.1, instead of 10.1.0.3. * common/u64subr.c: add function strtoi64 * h/u64subr.h: add prototype for function strtoi64 * rfio/rfio_fcalls.c: avoid warning at compile time under SLC4 * rfio/rfio_serv.c: avoid warning at compile time under SLC4 * common/: Cuuid.c, Cuuid.man, Imakefile: suppress Cuuid (not used and not easily portable to other platforms) * scripts/proc-init-cern-afs: tested to be working * scripts/: proc, proc-init-cern-afs: Oracle build almost working. * ns/Cns_oracle_drop.sql: drop index on pk_map_groupname and pk_map_username * ns/: Cns_mysql_drop.sql, Cns_oracle_drop.sql: drop also the index on Cns_file_replica(host) * test/srmv2.2/Imakefile: The cleanest and slimest version ever. GG. * test/srmv2.2/Imakefile: After severe trimming. GG. * test/srmv2.2/Imakefile: Initial version. GG. * ns/: Cns_mysql_tbl.sql, Cns_oracle_tbl.sql: change schema_version to 3.0.0 * srmv2.2/srmv2.2.sysconfig.oracle: set by default DB_IS_LOCAL="no" * srmv2.2/srmv2_xferreq.c: Allow ReleaseFiles only on PrepareToGet/BringOnline * srmv2.2/: srm.v2.2.wsdl, srmv2_dirreq.c, srmv2_spacereq.c: support for wsdl from 27th Septembre 2006 * ns/lfc.i: add support for method lfc_getreplicax * scripts/csec-hex-to-ascii.pl: aiding Csec debugging * test/srmv2/srm2_testGetRequestID.c: [no log message] * srmv2.2/: Imakefile, srmv2.2.man, srmv2.c: Initial release * h/srm_server.h: add support for SRM 2.2 * srmv2.2/: srmv2.2.logrotate, srmv2.2.scripts.mysql, srmv2.2.scripts.oracle, srmv2.2.sysconfig.mysql, srmv2.2.sysconfig.oracle: Initial release * srmv2.2/: srmv2.logrotate, srmv2.scripts.mysql, srmv2.scripts.oracle, srmv2.sysconfig.mysql, srmv2.sysconfig.oracle: renamed * h/: Cns_api.h, Cns.h, Cns_server.h, dpns_api.h, lfc_api.h: add support for SRM 2.2 * ns/Cns_main.c: add support for SRM 2.2 * ns/: Cns_addreplica.c, Cns_addreplica.man, Cns_addreplicax.man, Cns_getreplicax.c, Cns_getreplicax.man, Cns_listrep4gc.c, Cns_listrep4gc.man, Cns_listrepset.c, Cns_listrepset.man, Cns_modreplica.man, Cns_mysql_ifce.c, Cns_mysql_tbl.sql, Cns_oracle_ifce.pc, Cns_oracle_tbl.sql, Cns_procreq.c, Cns_setrltime.c, Cns_setrltime.man, Imakefile.dpns, Imakefile.lfc, send2nsd.c, sendrep.c: add support for SRM 2.2 * srmv2.2/: oralink.mk, srm.v2.2.wsdl, srm_util.c, srmlogit.c, srmv2.logrotate, srmv2.scripts.mysql, srmv2.scripts.oracle, srmv2.sysconfig.mysql, srmv2.sysconfig.oracle, srmv2_dirreq.c, srmv2_discovreq.c, srmv2_permreq.c, srmv2_spacereq.c, srmv2_xferreq.c, typemap.dat: Initial release * lcg-dm-common.spec: provides a shared library * DPM.spec: DPM-rfio-plugin provides rfio-plugin * dpm/Imakefile, ns/Imakefile, ns/Imakefile.cns, ns/Imakefile.dpns, ns/Imakefile.lfc: proc uses INCLUDE=..., instead of -I... * dpm/Imakefile: shared object shall not depend on itself * common/Imakefile, dpm/Imakefile, ns/Imakefile.cns, ns/Imakefile.dpns, ns/Imakefile.lfc, rfio/Imakefile, security/Imakefile: fixing ranlib * config/site.def: proper defaults * ns/Imakefile.lfc: [no log message] * dpm/dpm-drain.c: added fflush after printf to avoid buffered messages (GGUS ticket 15562) * dpm/dpm.scripts.oracle, ns/dpnsdaemon.scripts.oracle, ns/lfcdaemon.scripts.oracle, srmv1/srmv1.scripts.oracle, srmv2/srmv2.scripts.oracle: TWO_TASK or ORACLE_SID are correctly retrieved if NSCONFIG/DPMCONFIG contains several lines. * dpm/dpm-modifypool.c: correct check on length of policy names * dpm/dpm_util.c: fix processing of DPM PROTOCOLS entry from shift.conf * dli/dli.c: return "NoURLFound" instead of "Out of memory" if no replica found * CHANGES-long: Added changes for 1.5.10 release. * scripts/filter-manpage.sh: "cns_db" is the database name by default, and not "lfc_db" or "dpns_db". Fixed. * CHANGES: Fixed bug #19438: "Newly installed LFC doesn't publish information". * scripts/lcg-info-provider-lfc: Fixed bug #19438: "Newly installed LFC doesn't publish information". Changed ",o=grid" to ",mds-vo-name=local,o=grid". * dli/lfc-dli.scripts, dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle: "service xxx status" now returns a correct output if the daemon is not running, and the pid file exists but is empty. This happens when NSCONFIG is not accessible for instance. * rfio/rfio_callhandlers.c: include to avoid compile time warnings on some platforms add test on CSEC (build of insecure rfiod was not possible anymore) * dpm/dpm-drain.c: include to avoid copile time warnings on some platforms 2006-10-02 10:50 slemaitr - Before tagging 1.5.10 : * ns/lfc.i: increment reference count of Py_None to avoid interface crash * ns/Imakefile.lfc: make sure that the Perl/Python interfaces are rebuilt if lfc.i is changed * srmv2/srmv2_xferreq.c: all PinTimes in Status requests must be relative * dpm/: dpm-addpool.c, dpm-modifypool.c: take virtual ids into account * dpm/dpm.scripts.oracle, ns/dpnsdaemon.scripts.oracle, ns/lfcdaemon.scripts.oracle, srmv1/srmv1.scripts.oracle, srmv2/srmv2.scripts.oracle: Fixed bug in Oracle init.d script appearing only with some versions of bash. * dpm/: dpm_proclreq.c, poolmgr.c: do not always select the same replica (fix bug 19711) 2006-09-12 10:41 slemaitr - Before tagging 1.5.9 : * srmv2/srmv2.c: return SRM_INVALID_PATH if serrno == EISDIR * CHANGES: added bugs 18784, 18837, 19073, 19353 and 19736 fixed * ns/nsfind.c: add option "-type" * ns/: Cns_mysql_ifce.c, Cns_oracle_ifce.pc: correctly handle the case where both poolname and server are given (bug 18784) * dpm/dpm-drain.man: document syntax "--poolname pool_name [--server fs_server]" * dpm/dpm-drain.c: correctly process argument sets like "--poolname pool_name --server fs_server" correctly disable all concerned filesystems * ns/Cns_procreq.c: do not insert null comments in the DB (fix bug 18837) * dpm/dpm_proclreq.c: return EISDIR if dpm_get of a directory (fix GGUS ticket 9358) * dpm/: dpm-addfs.man, dpm-addpool.man, dpm-modifyfs.man, dpm-modifypool.man, dpm-rmfs.man, dpm-rmpool.man, dpm_addfs.man, dpm_addpool.man, dpm_modifyfs.man, dpm_modifypool.man, dpm_procreq.c, dpm_rmfs.man, dpm_rmpool.man: require ADMIN privilege for addfs, addpool, modifyfs, modifypool, rmfs and rmpool (bug 19073) * ns/nsls.c: remove unused variables * socket/dpmcli/dpm-Rm.c, socket/dpmcli/dpm-abortreq.c, socket/dpmcli/dpm-get.c, socket/dpmcli/dpm-getreqsummary.c, socket/dpmcli/dpm-gspt.c, socket/dpmcli/dpm-listReplicas.c, socket/dpmcli/dpm-put.c, socket/dpmcli/dpm-rm.c, socket/dpmcli/dpm-testPutTwo.c, socket/dpmcli/module.mk, test/dpm/globalSuite, test/dpm/socketSuite, test/srmv2/srmv2Suite: Update to allow for compatibility between DPM 1.5 and 1.6 series. GG. * common/log.c, dli/dlilogit.c, dpm/dpmlogit.c, ns/nslogit.c, srmv1/srmlogit.c, srmv2/srmlogit.c: allow to write logs larger than 2 GB (bug 19353) * dpm/dpm_procreq.c: fix call to dpm_rm_onereplica to avoid dpm server crash (bug GGUS 11886) * srmv2/srmv2_xferreq.c: fix memset argument list in StatusOfCopyRequest method * dpm/dpm_main.c, dpm/dpm_proclreq.c, ns/Cns_auth.c, rfio/rfio_callhandlers.c, rfio/rfio_serv.c: allow dpm requests to run as root (needed for dpm-replicate and dpm-drain) * CHANGES: Added bug #18688 fixed. * scripts/DPM-migration/virtualIds/migrate-mysql-schema-to-2-2-0.sql: Fixed bug bug #18688: DPM MySQL upgrade scripts uses hardcoded database name cns_db. * CHANGES: From now on, CHANGES-long contains all CVS changes, whereas CHANGES only contains significant changes, fixed bugs, and release dates. * ns/Cns_mysql_tbl.sql: Fix for bug #18689. Made sure that the schema_version table always had fields (major, minor, patch). * scripts/: migrate-mysql-schema-to-1-1-1.sql, DPM-migration/virtualIds/migrate-mysql-schema-to-2-2-0.sql, LFC-migration-1.4.0/migrate-mysql-schema-to-2-0-0.sql: Fix for bug #18689. Made sure that all schema_version fields were always (major, minor, patch). 2006-08-01 14:44 baud - Before tagging 1.5.8 : * VERSION: Upgrading to 1.5.8 * ns/Cns_aborttrans.c, ns/Cns_access.c, ns/Cns_addreplica.c, ns/Cns_chclass.c, ns/Cns_chdir.c, ns/Cns_chmod.c, ns/Cns_chown.c, ns/Cns_closedir.c, ns/Cns_creat.c, ns/Cns_delcomment.c, ns/Cns_delete.c, ns/Cns_deleteclass.c, ns/Cns_delreplica.c, ns/Cns_du.c, ns/Cns_endsess.c, ns/Cns_endtrans.c, ns/Cns_enterclass.c, ns/Cns_entergrpmap.c, ns/Cns_enterusrmap.c, ns/Cns_getacl.c, ns/Cns_getcomment.c, ns/Cns_getgrpbygid.c, ns/Cns_getgrpbynam.c, ns/Cns_getidmap.c, ns/Cns_getlinks.c, ns/Cns_getpath.c, ns/Cns_getreplica.c, ns/Cns_getusrbynam.c, ns/Cns_getusrbyuid.c, ns/Cns_listclass.c, ns/Cns_listlinks.c, ns/Cns_listrep4gc.c, ns/Cns_listreplica.c, ns/Cns_listreplicax.c, ns/Cns_mkdir.c, ns/Cns_modifyclass.c, ns/Cns_modifygrpmap.c, ns/Cns_modifyusrmap.c, ns/Cns_modreplica.c, ns/Cns_opendir.c, ns/Cns_queryclass.c, ns/Cns_readdir.c, ns/Cns_readdirc.c, ns/Cns_readdirg.c, ns/Cns_readdirx.c, ns/Cns_readdirxc.c, ns/Cns_readdirxr.c, ns/Cns_readlink.c, ns/Cns_rename.c, ns/Cns_rmdir.c, ns/Cns_rmgrpmap.c, ns/Cns_rmusrmap.c, ns/Cns_setacl.c, ns/Cns_setatime.c, ns/Cns_setcomment.c, ns/Cns_setfsize.c, ns/Cns_setptime.c, ns/Cns_setratime.c, ns/Cns_setrstatus.c, ns/Cns_setrtype.c, ns/Cns_startsess.c, ns/Cns_starttrans.c, ns/Cns_stat.c, ns/Cns_symlink.c, ns/Cns_undelete.c, ns/Cns_unlink.c, ns/Cns_utime.c, ns/nsshutdown.c, ns/send2nsd.c, h/Cns_constants.h, h/dpns.h, h/lfc.h: add timeouts in Cns clients * security/Csec_plugin_GSS.c: fix VOMS error messages * dpm/: dpm_abortfiles.man, dpm_put.man: better explanation of the method and its parameters * dpm/dpm_oracle_ifce.pc: add automatic retry on more Oracle errors * ns/Cns_procreq.c: retry once in getidmap if DB connection broken * ns/Cns_oracle_ifce.pc: automatic retry on more Oracle errors * CHANGES-long: From now on, CHANGES-long contains all CVS changes, whereas CHANGES only contains significant changes, fixed bugs, and release dates. * scripts/change-se-name/set-host-consistently-with-sfn.pl: Changing only the inconsistent entries. * scripts/change-se-name/set-host-consistently-with-sfn.pl: Taking password from file, instead from command line. * scripts/change-se-name/set-host-consistently-with-sfn.pl: Script that : - given a host name, present in the Cns_file_replica(host) field - changes it with the host in the Cns_file_replica(sfn) : * "sfn:///.../..." * "srm:///.../..." * dpm/dpm_replicate.c: include rfio_api.h instead of rfio.h * ns/Cns_procreq.c: add method modreplica() * ns/Cns_main.c: add method modreplica() * DPM.spec, LFC.spec: add method modreplica() * h/Cns.h, h/Cns_api.h, h/dpns_api.h, h/lfc_api.h, ns/Imakefile.dpns, ns/Imakefile.lfc: add method modreplica() * ns/: Cns_modreplica.c, Cns_modreplica.man: Initial release * ns/lfcdaemon.scripts.oracle, ns/dpnsdaemon.scripts.oracle, dpm/dpm.scripts.oracle, srmv1/srmv1.scripts.oracle, srmv2/srmv2.scripts.oracle: Added check before starting daemon, in case Oracle client is not installed. Fix for bug #15615 and #15616. * LFC-oracle.spec, DPM-oracle.spec: Removed dependency on oracle-instantclient-basic RPM. Fix for bug #15615 and #15616. * ns/: Cns_setrtype.c, Cns_setrtype.man: Initial release * ns/Imakefile.lfc, ns/Imakefile.dpns, DPM.spec, LFC.spec: add method setrtype() * ns/Cns_procreq.c: add method setrtype() fix buffer overflow in readdirx method (bug 18196) * ns/Cns_main.c: add method setrtype() * h/Cns_constants.h: define DIRGSIZE * h/: Cns.h, Cns_api.h, dpns_api.h, lfc_api.h: add method setrtype() * scripts/change-se-name/update-LFC-after-SE-renamed.pl: Changed oldPath and newPath examples to be more generic. * scripts/change-se-name/update-LFC-after-SE-renamed.pl: Added the possibility to specify an old path and a new path (in order to be able to do "sfn" to "srm" conversions, for instance). * lcg-dm-common.spec: Added Cthread man page to lcg-dm-common RPM. * dpm/dpm.scripts.oracle, dpm/dpm.sysconfig.oracle, ns/dpnsdaemon.scripts.oracle, ns/dpnsdaemon.sysconfig.oracle, ns/lfcdaemon.scripts.oracle, ns/lfcdaemon.sysconfig.oracle, srmv1/srmv1.scripts.oracle, srmv1/srmv1.sysconfig.oracle, srmv2/srmv2.scripts.oracle, srmv2/srmv2.sysconfig.oracle: For bug #17733 : $TWO_TASK (or $ORACLE_SID if database is installed locally) is taken from NSCONFIG or DPMCONFIG. No need to put it in the sysconfig files anymore. * ns/Cns_procreq.c: rename did not work if the target name was an existing link (bug 17588) * ns/lfc.i: Added Antonio's fix for "invalid pointer" and segmentation fault bug when using lfc_getreplica. See bug #17569 or GGUS ticket #9169. * ns/: lfc.i, lfc_python.man: The first value returned by lfc_getreplica is actually the method return code, not the number of replicas. * test/dpm/globalSuite: Improving the way the vomses file is created and processed (CreateProxy). * scripts/DPM-migration/virtualIds/create-uid-gid-mappings.sh: If several groups have the same gid, an error appears, and the script is exited. * scripts/LFC-migration-1.4.0/create-uid-gid-mappings.sh: If two groups have the same gid, an error is returned and the file is exited. * scripts/migrate-oracle-schema-to-2-3-0.sql: Script to change the UNIQUE constraints in Cns_file_replica, Cns_groupinfo and Cns_userinfo to PRIMARY KEYS. The indexes created by the UNIQUE constraints are dropped before the PRIMARY KEYS are created. * ns/Cns_oracle_tbl.sql: Upgrading schema version in schema_version table. * ns/Cns_oracle_tbl.sql: Changed UNIQUE constraint into PRIMARY KEY for Cns_file_replica(sfn), Cns_userinfo(username) and Cns_groupinfo(groupname), so that a FAST REFRESH on materialized views can be done on these tables. * lcg-dm-common.spec: Fix ownership of files to be root, not the package builder. * dli/Imakefile, dpm/Imakefile, ns/Imakefile, srmv1/Imakefile, srmv2/Imakefile, test/srmv1/Imakefile, test/srmv2/Imakefile: Rolling back the build changes on request of J-P.B, and instead applying workarounds on-the-fly during the build. * dpm/Imakefile: One has to enumerate all Globus libraries, if the Globus lib directory is not in LD_LIBRARY_PATH. * dli/Imakefile, dpm/Imakefile, ns/Imakefile, srmv1/Imakefile, srmv2/Imakefile, test/srmv1/Imakefile, test/srmv2/Imakefile: One has to enumerate all Globus libraries, if the Globus lib directory is not in LD_LIBRARY_PATH. * build.xml: getting desperate... * config/site.def: Chaged SwigLocation from /usr to /opt/lcg, so that the build on the LCG build machine keeps on working without any change. * test/dpm/globalSuite: One more improvement to account for DPM servers with _no_ disk server. * test/dpm/globalSuite: Improvement in rfioSuite and gsiftpSuite testings with a disk server configuration. * scripts/choose-module: SwigLocation is changed from /usr to /opt/lcg for the LFC and DPM builds. Removed dm-common) as only dm) is used. * build.xml: another debug command... * build.xml: another debug command... * build.xml: debuggin the remote build * test/dpm/globalSuite: Small fix in gfal_test call. * test/dpm/globalSuite: Fixed gfal_test issue with test file written in wrong dir. * LFC.spec, LFC-oracle.spec: Removed /etc/cron.d/ creation from spec files. * build.xml: gLite build pieces * config/site.def: By default CGSI_gSOAP has /usr prefix. * config/site.def: GSOAP default location is /usr/local from now on. * lib/Imakefile, shlib/Imakefile: define empty targets all, install and export in case both BuildNameServerAsLFC and BuildNameServerAsDPNS are set to NO * config/site.def: Added SwigLocation and CgsiGsoapLocation. * dpm/Imakefile, ns/Imakefile.lfc: Using dynamic discovery of Perl and Python include directories via the perl and python binaries. * dli/Imakefile, srmv1/Imakefile, srmv2/Imakefile, test/srmv1/Imakefile, test/srmv2/Imakefile: Using explicit CGSI_gSOAP location and a different GSOAP directory layout. Not building stdsoap2.o, but using the gsoap library. * config/: aix.cf, darwin.cf, linux.cf, sun.cf: Using dynamic discovery of INCLUDE_PERL location via the defaulf Perl command * config/Imake.rules: If there was a build failure in a subdir, then it would be expressed in the result of the whole build, although the build continues through the rest of the subdirs. * oracle-instantclient/: make-oracle-rpm, oracle-instantclient-basic-lcg.spec: Removing from repository : the RPMs now depend on the official oracle-instantclient-basic Oracle RPM, and we don't need to build our own anymore. * rfio/Imakefile: Rfio is now compiled in debug mode. * ns/Imakefile: Added debug flag for LFC and DPNS. * ns/nschown.c: fix for dot in group (vo) names was incomplete 2006-04-28 14:51 slemaitr - Before tagging 1.5.7 : * test/srmv2/srm2_testReleaseFiles.c: Improve keepFlag processing. * test/: dpm/globalSuite, dpm/socketSuite, srmv2/srmv2Suite: Recent enhancements. Target mainly error codes in xCuteComm. * socket/dpmcli/: dpm-Ls.c, dpm-addreplica.c, dpm-delreplica.c, dpm-getgrpbynam.c, dpm-getusrbynam.c, dpm-testPutTwo.c, module.mk: New CLIs. One (dpm-testPutTwo) is indeed a test command. * socket/dpmcli/dpm-put.c: Fix s_token bug. * socket/dpmcli/dpm-Rm.c: Minor fixes. * scripts/multiple-domains/updateDomainName: Added a test in case the domain name specified is empty : "". * ns/: lfcdaemon.scripts.mysql, lfcdaemon.scripts.oracle, lfcdaemon.sysconfig.mysql, lfcdaemon.sysconfig.oracle: Allowing core dump creation if LFC daemon crashes. * ns/: Cns_getlinks.man, Cns_getreplica.man: fix typo in description * scripts/lcg-info-provider-lfc: James amde sure that the DN in the Info Sys is correct. * dpm/dpm_procreq.c: log r_token and surls in abortfiles and relfiles methods * scripts/lcg-info-provider-lfc: In case lcg-dm-common is not installed, LFC_VERSION="" (fixed by James). * srmv1/srmv1_procreq.c: log all dpm_ call failures correct decoding of user/group in getFileMetaData when VIRTUAL_ID is defined * srmv2/srmv2_xferreq.c: log all dpm_ call failures * LFC-oracle.spec, LFC.spec: Added the lcg-info-provider-lfc script to the RPMs. * scripts/lcg-info-provider-lfc: Adding James' LFC info provider to the repository. * srmv2/srmv2_dirreq.c: correct decoding of user/group in srmLs when VIRTUAL_ID is defined * dpm/poolmgr.c, h/dpm_server.h: pass increment to dpm_updfreespace as signed64 log increment and free space in dpm_selectfs and dpm_updfreespace * dpm/send2dpm.c, ns/send2nsd.c: do not set error message "No valid credential found" if serrno == SECOMERR or serrno == SETIMEDOUT * dpm/send2dpm.c, ns/send2nsd.c: do not force serrno = ESEC_NO_CONTEXT if Csec_client_establishContext fails to be able to get also SETIMEDOUT * srmv2/srmv2.c: map SETIMEDOUT to SRM_INTERNAL_ERROR * security/Csec_plugin_GSS.c: keep detailed error message from VOMS_Retrieve * DPM-oracle.spec, DPM.spec, LFC-oracle.spec, LFC.spec: Added dependendy on CGSI_gSOAP_2.6-voms RPM. * dli/lfc-dli.scripts, dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, rfio/rfiod.scripts, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle: Improved the stop/restart behaviour. * dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle: Added a check for the case of empty NSCONFIG and DPMCONFIG files. 2006-04-12 11:10 slemaitr - Before tagging 1.5.6 : * ns/Cns_procreq.c: The last access time when reading a directory is not updated if the LFC is started as READ-ONLY. * scripts/RLS-Atlas-migration/bin/: migrate_files.o, migrate_files, migrate_info, migrate_info.o, migrate_path.o, migrate_path: Removing the platform specific files. Users should compile themselves. * DPM-oracle.spec, DPM.spec: Added the changeDpmName to the DPM-name-server-mysql and DPM-name-server-oracle RPMs. * scripts/change-dpm-name/README: Pointer to the Wiki documentation. * scripts/change-dpm-name/: Common.pm, UpdateDpmDatabase.pm, changeDpmName: The script now works if the SRM server and the Disk Server are two different machines. Fully tested for MySQL and Oracle. * scripts/change-dpm-name/: changeDpmName, Common.pm, UpdateDpmDatabase.pm: Script that modifies the DPM and DPNS databases, in case the DPM server has been renamed. * DPM.spec: add targets for drain, replicate, abortfiles and delreplica * h/dpm_server.h: new prototype for dpm_selectfs (to support replicate) * h/dpm_api.h: add prototypes for abortfiles, copyfile, delreplica and replicate * dpm/Imakefile: add suppoprt for drain, replicate, abortfiles and delreplica * dpm/: dpm_copyfile.c, dpm_replicate.c: Initial release * dpm/dpm_main.c: add support for abortfiles and delreplica * dpm/poolmgr.c: add support for replicate in selectfs * dpm/dpm_procreq.c: add support for: abortfiles, delreplica, replicate fix abortreq (free space) * dpm/dpm_proclreq.c: add support for replicate * srmv2/: srmv2_dirreq.c, srmv2_permreq.c, srmv2_xferreq.c: align some StatusCodes with new spec * srmv2/srmv2_spacereq.c: return StatusCode = SRM_INTERNAL_ERROR instead of SOAP_FAULT if DB open error * h/dpm.h: define DPM_DELREPLICA * dpm/: dpm-drain.c, dpm-drain.man, dpm-replicate.c, dpm-replicate.man, dpm_abortfiles.c, dpm_abortfiles.man, dpm_delreplica.c, dpm_delreplica.man: Initial release * dpm-drain.c, dpm-drain.man, dpm-replicate.c, dpm-replicate.man, dpm_abortfiles.c, dpm_delreplica.c, dpm_delreplica.man, dpm_abortfiles.man: should not be here (wrong directory) * dpm-drain.c, dpm-drain.man, dpm-replicate.c, dpm-replicate.man, dpm_abortfiles.c, dpm_abortfiles.man, dpm_delreplica.c, dpm_delreplica.man: Initial release * DPM.spec: rfdf is in the correct alphabetical order now. * srmv2/srmv2.c: map SECOMERR and SEINTERNAL to SRM_INTERNAL_ERROR * ns/Cns_procreq.c: - fix a race condition between unlink and addreplica - setrstatus: requires write permission to delete active replica * dpm/dpm-qryconf.man: add domain name * ns/nschown.c: fix "usage" format to agree with the new syntax * ns/nschown.c: allow only colon as separator between user and group (some DNs or VO names have dots in them) * dli/lfc-dli.scripts: Removed misleading comment. * dli/lfc-dli.logrotate: Fixed typo. * scripts/change-se-name/update-LFC-after-SE-renamed.pl: If the new replica already exists, the duplicate is automatically deleted. * LFC-interfaces.spec, DPM-interfaces.spec: Removed @OS@, because the build system does it itself. * LFC-oracle.spec, LFC.spec: Added /var/log/dli to be created in RPM_BUILD_ROOT and in the distributed files. * config/Imake.rules: Replace "chmod" by "-chmod" in the MakeDir macro, so that the RPM build doesn't fail as an ordinary user. Bug #14952 fixed. * dli/: lfc-dli.logrotate, lfc-dli.scripts, lfc-dli.sysconfig: Renamed the lfc-dli log file to be /var/log/dli/log. * dli/lfc-dli.scripts, dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, rfio/rfiod.scripts, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle: Added different return values for "status" : - running -> 0 - dead but pid file exists -> 1 - dead but subsys locked -> 2 - stopped -> 3 * dpm/: dpm_get.c, dpm_put.c: correct msglen to avoid valgrind errors * dpm/: dpm_abortreq.man, dpm_getstatus_copyreq.man, dpm_getstatus_getreq.man, dpm_getstatus_putreq.man: fix documentation of a few error codes * rfio/: rfiod.scripts, rfiod.sysconfig: Added the RFIO_PORT_RANGE environment variable definition. Value by default : "20000 25000" * rfio/rfiod.man: document RFIO_PORT_RANGE * rfio/: rfio_call64.c, rfio_calls.c: add processing of RFIO_PORT_RANGE * ns/: Cns_readdir.man, Cns_readdirc.man, Cns_readdirg.man, Cns_readdirx.man, Cns_readdirxc.man, Cns_readdirxr.man: Added details on when "serrno" is set or not. 2006-03-16 10:53 slemaitr - Before tagging 1.5.5 : * ns/Imakefile.dpns: FILTERMANPAGE was missing for dpns_readdirg, dpns_readlink and dpns_symlink. * DPM-oracle.spec, DPM.spec: Release number = 1. * scripts/change-se-name/update-LFC-after-SE-renamed.pl: Needed improvements. * scripts/: DPM-migration/virtualIds/create-uid-gid-mappings.sh, LFC-migration-1.4.0/create-uid-gid-mappings.sh: Added the possibility to specify another MySQL server than the machine where the script is executed. * ns/: Cns_getlinks.man, Cns_getreplica.man: fix typo in function prototype * DPM.spec, ns/Imakefile.dpns: Distributing dpns_readlink, dpns_symlink and dpns_readdirg man pages. * test/dpm/globalSuite: Improved proxy and glite client lib management. * ns/lfc.i: Added the memory leak management improvements done by Antonio Delgado Peris. * ns/swig_info: Adding doc from Antonio Delgado Peris to the repository. * scripts/change-se-name/update-LFC-after-SE-renamed.pl: Script to update the Cns_file_replica table after a SE has been renamed. Should not become public ! * ns/: nschclass.c, nschown.c, nsls.c, nsrm.c, nstouch.c: do not run command and print help message if unknown option specified * scripts/DPM-migration/virtualIds/migrate-mysql-schema-to-2-2-0.sql: Updating the dpm_db schema_version table before the indexes are created, so that, if the index creation fails, the schema_version is updated anyway. * scripts/DPM-migration/virtualIds/migrate-mysql-schema-to-2-2-0.sql: The dpm_db schema version is now also upgraded. * test/dpm/globalSuite: Slight improvements in pool server case management + possibility of using several certs. * DPM-oracle.spec, DPM.spec: Release number upgraded to 2 (this is only for the DPM-name-server RPM...). * ns/Cns_mysql_tbl.sql, ns/Cns_oracle_tbl.sql, dpm/dpm_mysql_tbl.sql, dpm/dpm_oracle_tbl.sql: Updated the schema version to 2.2.0. * DPM-oracle.spec: Fixed typo. 2006-02-27 10:03 slemaitr - Before tagging 1.5.4 : * ns/Cns_main.c: shorter lock time when handling virtual id mapping tables * test/dpm/globalSuite: Introduction of proxy type argument. * test/srmv2/srm2_testCheckPermission.c: Improvement to perm printout. * VERSION: Upgrading to version 1.5.4 * srmv2/srmv2_permreq.c: set userPermission in reply of CheckPermission * srmv2/srmv2_xferreq.c: more logging * dpm/dpm_procreq.c, srmv1/srmv1_procreq.c: more logging * ns/Cns_procreq.c: shorter lock time when handling virtual id mapping tables * ns/lfc_python.man: The lfc_readdirxr example is more meaningful now. * scripts/DPM-migration/virtualIds/: migrate-mysql-schema-to-2-2-0.sql, migrate-oracle-schema-to-2-2-0.sql: Changed the order in which the indexes are created, so that the missing ones are created if some already exist. * rfio/rfio_callhandlers.c: authorize stat requests on dpm managed files by trusted servers * ns/Cns_mysql_ifce.c: fix typo in Cns_update_unique_uid(): was releasing wrong mutex in some error conditions * DPM-oracle.spec, DPM.spec: Added the migration scripts for virtual Ids to the DPNS RPM. * dpm/: dpm_mysql_tbl.sql, dpm_oracle_tbl.sql: add index on u_token to improve getreqid speed * h/dpm_server.h: add prototype for dpm_get_pending_reqs_by_u_desc() * dpm/: dpm_mysql_ifce.c, dpm_oracle_ifce.pc, dpm_procreq.c: let getreqid check the pending request queue and the completed request queue * scripts/DPM-migration/virtualIds/: migrate-mysql-schema-to-2-2-0.sql, migrate-oracle-schema-to-2-2-0.sql: Added the two new indexes on dpm_pending_req(u_token) and dpm_req(u_token). * ns/lfc_python.man: Adding examples for lfc_getacl and lfc_setacl usage. * ns/lfc.i: Adding working lfc_getacl and lfc_setacl definitions for Python, that I got from Antonio Delgado Peris. * ns/Cns_procreq.c: fix the check validity of getattr option in readdir method * scripts/: LFC-migration-1.4.0/create-uid-gid-mappings.sh, DPM-migration/virtualIds/create-uid-gid-mappings.sh: Fixed bug #15083. (the password was not extracted correctly from the password file if it contained a "n"). 2006-02-13 17:15 slemaitr - Before re-tagging 1.5.2 : * DPM-oracle.spec, DPM.spec, LFC-oracle.spec, LFC.spec: RPMs depend on CGSI_gSOAP >= 1.1.15 now. * DPM-oracle.spec, LFC-oracle.spec: Removed useless space. See bug #14960. * DPM.spec: Removed a useless space. See bug #14960. * srmv2/srmv2_permreq.c: Reinserted the correct result for CheckPermissions. GG. * DPM-oracle.spec, DPM.spec: The directories for the virtualIds migration script/doc were not created... * DPM-oracle.spec: Fixed typo ("oracle" instead of "mysql"...) * DPM-oracle.spec, DPM.spec: Added the virtualIds migration script/doc to the DPNS rpms. * scripts/DPM-migration/virtualIds/create-uid-gid-mappings.sh: "/home" had the wrong parent_fileid. Fixed. 2006-02-10 11:20 slemaitr - Before tagging 1.5.1 : * dli/lfc-dli.scripts, dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, rfio/rfiod.scripts, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle: Added /opt/glite/lib to $LD_LIBRARY_PATH. 2006-02-09 18:05 slemaitr - Before re-tagging 1.5.0 : * DPM-oracle.spec, DPM.spec, LFC-oracle.spec, LFC.spec, lcg-dm-common.spec: The LFC and SRM server RPMs depend on CGSI_gSOAP_2.6 >= 1.1.14-2. The lcg-dm-common and client RPMs depend on glite-security-voms-api-c >= 1.6.16 and glite-security-voms-api >= 1.6.16. * lcg-dm-common.spec: RPM depends on glite-security-voms-api-c = 1.6.15, glite-security-voms-api = 1.6.15 now. * config/site.def: VomsLocation = /opt/glite instead of /opt/edg. * srmv1/Imakefile, srmv2/Imakefile: Changed the cgsi voms plugin name. * security/Imakefile: Modified $(VOMS_INCLUDE) to be consistent with the 1.6.15 voms RPMs. * DPM.spec, LFC.spec: LFC-client and DPM-client depend explicitely on glite-security-voms-api-c = 1.6.15 and glite-security-voms-api = 1.6.15 * LFC.spec, DPM-oracle.spec, DPM.spec, LFC-oracle.spec, lcg-dm-common.spec: Removed @OS@ and added @SECURITY@ in all the spec files. * dpm/dpm_procreq.c, ns/Cns_procreq.c, srmv1/srmv1_procreq.c, srmv2/srmv2_xferreq.c: make sure that the file size or the requested space is a positive value * h/osdep.h: define INT64_NEG * scripts/DPM-migration/virtualIds/create-uid-gid-mappings.sh: Corrected the name of the schema migration scripts called (wrong version...) * scripts/DPM-migration/virtualIds/: README, create-uid-gid-mappings.sh, migrate-mysql-schema-to-2-2-0.sql, migrate-oracle-schema-to-2-2-0.sql: Adding the scripts to migrate to virtualids/VOMS enabled DPM. * DPM.spec: Added the virtual ids man pages. * srmv2/Imakefile, srmv2/srm_util.c, srmv2/srmv2_dirreq.c, srmv2/srmv2_permreq.c, srmv2/srmv2_spacereq.c, srmv2/srmv2_xferreq.c, dpm/Imakefile, dpm/dpm_auth.c, dpm/dpm_main.c, dpm/dpm_proclreq.c, dpm/send2dpm.c: add support for VOMS-enabled DPM * rfio/Imakefile, rfio/connect.c, rfio/rfio_auth.c, rfio/rfio_callhandlers.c, security/Csec_api.c, security/Csec_protocol_policy.c, srmv1/Imakefile, srmv1/srm_util.c, srmv1/srmv1_procreq.c: add support for VOMS-enabled DPM * ns/: Cns_auth.c, Imakefile, Imakefile.lfc, send2nsd.c: add support for VOMS-enabled DPM * config/site.def, h/Cns_api.h, h/Csec_api.h, h/Csec_constants.h, h/dpm_api.h, h/dpns_api.h, h/lfc_api.h, h/rfio_api.h: add support for VOMS-enabled DPM * dpm/dpm.scripts.oracle, ns/dpnsdaemon.scripts.oracle, ns/lfcdaemon.scripts.oracle, srmv1/srmv1.scripts.oracle, srmv2/srmv2.scripts.oracle: Checking that $ORACLE_HOME exists. If not, failing to start. * DPM-oracle.spec, LFC-oracle.spec: Oracle RPMs depend on the official Oracle Instant Client (basic) RPM. 2006-01-31 16:31 slemaitr - Before tagging 1.4.6 : * dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle: Removed LD_LIBRARY_PATH=/opt/glite/lib:$LD_LIBRARY_PATH. * rfio/parse.c: better algorithm to detect if file is on localhost * test/srmv2/srmv2_testsuite: Srmv2 test, rewrote in python * dli/lfc-dli.logrotate, dpm/dpm.logrotate, ns/dpnsdaemon.logrotate, ns/lfcdaemon.logrotate, rfio/rfiod.logrotate, srmv1/srmv1.logrotate, srmv2/srmv2.logrotate: We have to keep all the logs for 90 days (instead of 15) according to a GRID agreement. * rfio/rfio_serv.c: make sure that localhost is an FDQN * rfio/rfio_calls.c: use localdomain instead of DOMAINNAME * common/isTrustedHost.c: go to next host name on TRUST line if current host name is too long * srmv2/srmv2_xferreq.c: protect against NULL pointers in request check if StatusOfGetRequest tries to get status of a PrepareToGet and idem for Put and Copy * srmv2/: srmv2_dirreq.c, srmv2_permreq.c, srmv2_spacereq.c: protect against NULL pointers in request always log return code of the method * h/Cns_server.h: add prototype for Cns_update_unique_gid() and Cns_update_unique_uid() * rfio/rfio_serv.c: enable opendir requests from remote sites if valid proxy * rfio/: rfrm.c, rfrm.man: add option -f to disable prompting * common/serror.c, h/serrno.h, h/serrno.man: fix mismatch between serrno.h and serror.c about error 1037 * test/srmv2/: srm2_testAbortFiles.c, srm2_testAbortRequest.c, srm2_testChangeFileStorageType.c, srm2_testCheckPermission.c, srm2_testCopy.c, srm2_testExtendFileLifeTime.c, srm2_testGet.c, srm2_testGetRequestID.c, srm2_testGetRequestSummary.c, srm2_testMkdir.c, srm2_testPut.c, srm2_testPutDone.c, srm2_testReleaseFiles.c, srm2_testRemoveFiles.c, srm2_testResumeRequest.c, srm2_testRm.c, srm2_testRmdir.c, srm2_testSetPermission.c, srm2_testSuspendRequest.c: More cleanup. * test/srmv2/: srm2_testAbortFiles.c, srm2_testAbortRequest.c, srm2_testChangeFileStorageType.c, srm2_testCheckPermission.c, srm2_testCopy.c, srm2_testExtendFileLifeTime.c, srm2_testGet.c, srm2_testGetRequestID.c, srm2_testGetRequestSummary.c, srm2_testPut.c, srm2_testPutDone.c, srm2_testReleaseFiles.c, srm2_testRemoveFiles.c, srm2_testResumeRequest.c, srm2_testRm.c, srm2_testRmdir.c, srm2_testSetPermission.c, srm2_testSuspendRequest.c: Some cleanup. Also : implement several pointer testing (protected thru CRASH_TEST env. var.) * test/dpm/globalSuite: Implemented gsiftpSuite and rfioSuite. * srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle, srmv2/srmv2.sysconfig.mysql, srmv2/srmv2.sysconfig.oracle, dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, dpm/dpm.sysconfig.mysql, dpm/dpm.sysconfig.oracle, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/dpnsdaemon.sysconfig.mysql, ns/dpnsdaemon.sysconfig.oracle, srmv1/srmv1.sysconfig.mysql, srmv1/srmv1.sysconfig.oracle: Implement the ALLOW_COREDUMP feature; Insert /opt/glite/lib in the LD_LIBRARY_PATH. 2006-01-19 10:57 slemaitr - Before tagging 1.4.5 : * dli/dli.c: fix call to lfc_getreplica * LFC-oracle.spec, LFC.spec: Added README and migrate-oracle-schema-to-2-1-0.sql * scripts/LFC-migration-1.4.0/README: Pointer to the Wiki page on how to upgrade to LFC version 1.4.4. * scripts/LFC-migration-1.4.0/: migrate-mysql-schema-to-2-0-0.sql, migrate-oracle-schema-to-2-0-0.sql: Change the schema version to 2-1-0. * ns/: Cns_mysql_tbl.sql, Cns_oracle_tbl.sql: Upgrading schema version to 2-1-0 (change in the schema for Oracle only). * scripts/LFC-migration-1.4.0/migrate-oracle-schema-to-2-1-0.sql: Migration script to go from LFC 1.4.1 to 1.4.4. It deletes the sequences and creates the tables needed. * test/dpm/globalSuite: Improving rfio command path. * ns/Cns_getidmap.man: Removed the EACCES error, as it cannot occur. 2006-01-16 16:55 slemaitr - Before re-tagging 1.4.4 : * ns/Cns_oracle_drop.sql: change sequences into tables for Virtual ids to support entergrpmap and enterusrmap * scripts/LFC-migration-1.4.0/: create-uid-gid-mappings.sh, migrate-oracle-schema-to-2-0-0.sql: The virtual uids/gids use a table (instead of a sequence) to store the current maximal uid/gid. * ns/: Cns_mysql_tbl.sql, Cns_oracle_tbl.sql: The schema version in the lcg1_4_4 release is 2.0.0 * h/Cthread_api.h: does not include . It's not needed and breaks the precompilation by proc (Oracle) * ns/Cns_oracle_tbl.sql: change sequences into tables for Virtual ids to support entergrpmap and enterusrmap * ns/: Cns_mysql_ifce.c, Cns_oracle_ifce.pc, Cns_procreq.c: update unique virtual id tables in entergrpmap and enterusrmap * ns/: Cns_entergrpmap.man, Cns_enterusrmap.man, Cns_procreq.c: fix processing of unspecified uid/gid in entergrpmap and enterusrmap * security/Csec_plugin_GSS.c: fix compilation with KRB5 without GSI * DPM.spec: Fixed typo. 2006-01-12 18:10 slemaitr - Before tagging 1.4.3 : * LFC-oracle.spec, Imakefile: Removed lcgdm-mkgridmap. * LFC.spec: Removed lcgdm-mkgridmap. * DPM.spec: Added the missing commands/man pages, and removed the mappings ones. * scripts/LFC-migration-1.4.0/create-uid-gid-mappings.sh: Sleeping longer after "service lfcdaemon stop"... * ns/: Imakefile.dpns, Imakefile.lfc: add rules for entergrpmap and enterusrmap * ns/Cns_main.c: add processing for entergrpmap() and enterusrmap() * ns/Cns_procreq.c: add processing for entergrpmap() and enterusrmap() * ns/: Cns_entergrpmap.c, Cns_entergrpmap.man, Cns_enterusrmap.c, Cns_enterusrmap.man, nsentergrpmap.c, nsentergrpmap.man, nsenterusrmap.c, nsenterusrmap.man: Initial release * h/: Cns.h, Cns_api.h, dpns_api.h, lfc_api.h: add methods Cns_entergrpmap() and Cns_enterusrmap() * ns/: Cns_getidmap.man, Cns_modifygrpmap.man, Cns_modifyusrmap.man, Cns_rmgrpmap.man, Cns_rmusrmap.man: Added the EACCES error. * LFC.spec: Added lfc-enterusrmap and lfc-entergrpmap commands and man pages to the RPMs. * scripts/LFC-migration-1.4.0/create-uid-gid-mappings.sh: The database password is no longer displayed. * scripts/LFC-migration-1.4.0/create-uid-gid-mappings.sh: Fixed a bug : the groups weren't added when using MySQL... * ns/lfc_python.man: Added example for the lfc_getreplica method. * test/: dpm/globalSuite, dpm/socketSuite, srmv1/srmv1Suite, srmv2/srmv2Suite: Added subTree argument for communication between all scripts. * ns/lfc.i: Committing Antonio's changes (with a small modification) : lfc_getreplica and lfc_readdirxr are now fully usable in python. 2006-01-09 14:38 slemaitr - Before tagging 1.4.2 : * Imakefile: The "rpm" and "rpm-oracle" targets first remove the SOURCES, BUILD and SPECS directories. * test/dpm/globalSuite: Inserted voms-proxy info printout. * socket/dpmcli/dpm-Rm.c: Initial release. * ns/Cns_procreq.c: fix return codes of Cns_vo_from_dn(): should return serrno and not -1 * ns/Cns_getidmap.c: fix the returning of gids when nbgroups != 1 * srmv2/srmv2_xferreq.c: fix typo * dpm/dpm_procreq.c, rfio/rfio_callhandlers.c, srmv1/srmv1_procreq.c, srmv2/srmv2_xferreq.c: add support for multi-domain * dpm/Imakefile, ns/Imakefile.lfc: move python/perl directories creation targets towards the end so that the "all" target is the first one * socket/dpmcli/: dpm-getreqid.c, dpm-getreqstatus.c, module.mk: Same string of updates (better error processing). * socket/: dpmcli/dpm-getreqstatus.c, dpmcli/dpm-put.c, goputils/gop_comm.h, goputils/gop_glob.c, goputils/gop_help.c, goputils/gop_pars.c: Various upgrades, including dpmhost. * config/Project.tmpl: suppress definition of INTERFACEDIR (not used anymore) * socket/dpmcli/dpm-getreqid.c: Protect against DP*_HOST names mismatch (2 APIs). * dpm/: dpm_mysql_tbl.sql, dpm_oracle_tbl.sql: add index on "pfn" column of dpm_get_filereq/dpm_put_filereq tables * srmv2/srmv2_dirreq.c: fix listing of directories log surls for Ls method * test/srmv2/srm2_testLs.c: After cleanup. * test/srmv2/srm2_testLs.c: Improvement: added recursivity due to numOfLevels. * ns/Cupv_check.c: fix sccsid * ns/Cupv_check.c: only check trusted host if client is root, else return EACCES * ns/lfc_python.man: Added example usage of lfc_readdirxr. * ns/Cns_procreq.c: fix setacl processing of group/mask permissions * ns/Cns_main.c: do not abort a transaction when any of the read requests fails * scripts/RLS-Cms-migration/README: Adding to the repository. * scripts/RLS-Cms-migration/: lib/Cms.pm, lib/Common.pm, bin/Makefile, bin/migrate_RLS_entries, bin/migrate_files.c, bin/migrate_info.c, bin/migrate_path.c: Adding to the repository. * scripts/choose-module: Fixed usage output. * DPM-oracle.spec, DPM.spec: Added message about the migration script for the multi-domain DPM. * dpm/: dpm_mysql_drop.sql, dpm_oracle_drop.sql: The "schema_version" table is now dropped as well. * ns/Cns_oracle_drop.sql: Script dropping all the Name Server tables/indexes/sequences. * ns/Cns_procreq.c: avoid memory leak in creat(), rename() and unlink() when replica do not exist * scripts/LFC-migration-1.4.0/create-uid-gid-mappings.sh: The database password is now taken from a file, instead of the command line, for security reasons. * scripts/multiple-domains/: Common.pm, UpdateDpmDatabase.pm, updateDomainName: The script now also updates the 'server' field in the "dpm_fs" table. The database password is now taken from a file instead of the command line, for security reasons. * dpm/send2dpm.c, ns/send2nsd.c: protect against too large replies from the server * security/Csec_plugin_GSS.c: Removed debug printf() from Csec_plugin_GSS.c * test/srmv1/: my_rfcp_in.sh, my_rfcp_out.sh: Introducing NEW_RFIOD_SYNTAX switch. * test/srmv2/srm2_testPut.c: Fixing argument count. * test/dpm/globalSuite: Recognize now when the srmv2 server is of lbnl type. * dpm/poolmgr.c: do not try to do garbage collection if pool capacity is zero (probably the file systems are unaccessible) * lcg-dm-common.spec: Right permissions on the man pages. * security/Csec_plugin_GSS.c: Fix memory leak on error in Csec_acquire_creds() and fix returned serrno values in Csec_server_establish_context_ext() & Csec_client_establish_context() * LFC-oracle.spec, LFC.spec: Added lfc-dli-client and its manpage to the LFC-server RPMs. * dli/: lfc-dli-client.c, lfc-dli-client.man: use DLI port, not LFC_PORT * dli/lfc-dli-client.man: added man page for lfc-dli-client * dli/: Imakefile, dli.c, dli_testlistReplicas.c, lfc-dli-client.c, lfc-dli-client.man: Fix bug #14011 overview: LFC DLi should use getreplica() Also, create more generic client for interfacing to the DLI - this will be used in automatic monitoring scripts * test/: dpm/globalSuite, dpm/socketSuite, srmv1/srmv1Suite, srmv2/srmv2Suite: Cleanup related to new rfcp version. * test/srmv2/srm2_testPut.c: Removing a possible loop. * rfio/parse.c: support directly TURL syntax (rfio://...) * rfio/: connect.c, rfcp.c, stream.c: support directly TURL syntax (rfio://...) * test/srmv1/: my_dccp_in.sh, my_dccp_out.sh, my_gsiftp_in.sh, my_gsiftp_out.sh, my_rfcp_in.sh, my_rfcp_out.sh: removed extra comments and some stuff from these helper scripts * LFC.spec, lcg-dm-common.spec: Added the dependencies on voms RPMs version 1.5.4 * scripts/LFC-migration-1.4.0/create-uid-gid-mappings.sh: The sequence/table must start with max_uid + 1 (and max_gid + 1) 2005-11-28 14:23 slemaitr - Before tagging 1.4.1 : * test/srmv2/: srm2_testget.c, srm2_testput.c: use modified wsdl * h/dpm_api.h: Fixed typo. * dpm/README, h/dpm_api.h: Removed dpm_replicate. * ns/Imakefile.lfc: Renamed lfc.3pm to lfc_perl.man and lfc.3py to lfc_python.man * config/Imake.rules: Removed the InstallManPage target (not needed anymore since Perl and Python interfaces man pages have been renamed.) * LFC-interfaces.spec: Renamed lfc.3pm to lfc_perl.man and lfc.3py to lfc_python.man * ns/: lfc_perl.man, lfc_python.man: Renamed lfc.3pm to lfc_perl.man and lfc.3py to lfc_python.man. * ns/: lfc.3pm, lfc.3py: Rename lfc.3pm to lfc_perl.man and lfc.3py to lfc_python.man * DPM.spec: Added the dpm_copy man page. * ns/: Cns_closedir.c, Cns_closedir.man: set serrno to EFAULT and returns -1 if dirp is NULL * scripts/choose-module: BuildSecurity = YES for LFC and DPM. * dpm/Imakefile, ns/Imakefile, ns/Imakefile.cns, ns/Imakefile.dpns, ns/Imakefile.lfc: Splitted the man pages for Client, Server and Library. * DPM.spec, LFC.spec: Added missing man pages (for new methods). * ns/send2nsd.c: include string.h to avoid warnings at compile time * ns/: Cns_getgrpbygid.c, Cns_getgrpbynam.c, Cns_getidmap.c, Cns_getusrbynam.c, Cns_getusrbyuid.c, Cns_modifygrpmap.c, Cns_modifyusrmap.c, Cns_rmgrpmap.c, Cns_rmusrmap.c: include string.h and unistd.h to avoid warnings at compile time * h/dpm_util.h: add prototype for build_proxy_filename * security/Csec_plugin_GSS.c: Change Csec_plugin_GSS.c to fix memory leak * ns/Cns_setatime.c: fix in case file_uniqueid is NULL * dpm/dpm_util.c: add Copyright and sccsid * common/isTrustedHost.c, dpm/dpm_util.c, ns/Cns_selectsrvr.c, ns/Cupv_check.c, rfio/connect.c, rfio/stream.c: use strtok_r * dpm/: dpm_abortreq.c, dpm_apiinit.c, dpm_copy.c, dpm_errmsg.c, dpm_extendfilelife.c, dpm_freefilestatuses.c, dpm_get.c, dpm_getprotocols.c, dpm_getreqid.c, dpm_getreqsummary.c, dpm_getspacemd.c, dpm_getspacetoken.c, dpm_getstatus_copyreq.c, dpm_getstatus_getreq.c, dpm_getstatus_putreq.c, dpm_getturl.c, dpm_inc_reqctr.c, dpm_put.c, dpm_putdone.c, dpm_relfiles.c, dpm_rm.c: fix function prototypes * ns/Cns_main.c: fix code to obtain basename of daemon name * dpm/send2dpm.c: fix typo in precompiler flag * dpm/dpm_procreq.c: include netinet/in.h to get htonl/ntohl definition * dpm/dpm_getturl.c: include to get the prototype for free() include to get the prototype for sleep() * h/dpm_api.h: add prototypes for dpm_apiinit and send2dpm * h/: dpns_api.h, lfc_api.h: define send2nsdx * dpm/: dpm_copy.c, dpm_get.c, dpm_getpoolfs.c, dpm_getpools.c, dpm_getreqid.c, dpm_getreqsummary.c, dpm_getspacemd.c, dpm_getspacetoken.c, dpm_getstatus_copyreq.c, dpm_getstatus_getreq.c, dpm_getstatus_putreq.c, dpm_put.c, dpm_putdone.c, dpm_relfiles.c, dpm_rm.c: use correct prototype for send2dpm * ns/: Imakefile.dpns, Imakefile.lfc: add rules for getlinks, getreplica and readdirxr * dpm/: dpm_mysql_ifce.c, dpm_oracle_ifce.pc: automatic reconnect to the DB if connection was lost * ns/Cns_procreq.c: add support for methods getlinks, getreplica, readdirxr do not fail transactions on "get" methods * ns/Cns_main.c: allow number of threads to be set at startup time fix timeout processing in directory and list operations add support for getlinks and getreplica methods * h/Cns_api.h: add prototypes and structure definitions for new methods getlinks, getreplica and readdirxr * h/: Cns.h, dpns_api.h, lfc_api.h: defines for support of new methods: getlinks, getreplica, readdirxr * ns/Imakefile: add support for Perl and Python interfaces * ns/: send2nsd.c, sendrep.c: add support for getreplica, getlinks and readdirxr methods * ns/nsdaemon.man: add option -t to specify the number of threads * ns/Cns_opendirxg.man: Initial release * ns/: Cns_opendir.c, Cns_opendirg.man: add method Cns_opendirxg * ns/Cns_oracle_ifce.pc: automatic reconnect to the DB if connection was lost number of threads configurable at startup time * ns/Cns_mysql_ifce.c: automatic reconnect to the DB if connection was lost * ns/Cns_closedir.c: free structures allocated by readdirxr method * ns/: Cns_getlinks.c, Cns_getlinks.man, Cns_getreplica.c, Cns_getreplica.man, Cns_readdirxr.c, Cns_readdirxr.man: Initial release * ns/: dpnsdaemon.scripts.mysql, dpnsdaemon.scripts.oracle, dpnsdaemon.sysconfig.mysql, dpnsdaemon.sysconfig.oracle: Added possibility to specify the number of threads for the DPNS daemon. * test/srmv2/srm.v2.1.1.wsdl: New WSDL for so-called lbnl version. * ns/: lfcdaemon.sysconfig.mysql, lfcdaemon.sysconfig.oracle: The LFC should be read-write by default. * ns/: lfcdaemon.scripts.mysql, lfcdaemon.scripts.oracle, lfcdaemon.sysconfig.mysql, lfcdaemon.sysconfig.oracle: Added the possibility to run the LFC as read-only and to specify the number of threads when running the daemon. * test/srmv2/: srm2_testAbortFiles.c, srm2_testAbortRequest.c, srm2_testChangeFileStorageType.c, srm2_testCheckPermission.c, srm2_testCompactSpace.c, srm2_testCopy.c, srm2_testGet.c, srm2_testGetRequestID.c, srm2_testGetRequestSummary.c, srm2_testGetSpaceMetaData.c, srm2_testGetSpaceToken.c, srm2_testLs.c, srm2_testMv.c, srm2_testPut.c, srm2_testPutDone.c, srm2_testReassignToUser.c, srm2_testReleaseFiles.c, srm2_testRemoveFiles.c, srm2_testResumeRequest.c, srm2_testRm.c, srm2_testSetPermission.c, srm2_testSuspendRequest.c: New srmv2 WSDL definition (so-called lbnl version). * srmv2/: srm.v2.1.1.wsdl, srmv2_dirreq.c, srmv2_permreq.c, srmv2_spacereq.c, srmv2_xferreq.c: switch to use modified wsdl * dpm/: dpm_mysql_tbl.sql, dpm_oracle_tbl.sql: Added the "schema_version" table. * DPM-oracle.spec, DPM.spec: Added the scripts to migrate the DPM schema (missing indexes + schema_version table) to the RPM. * scripts/DPM-migration/: migrate-mysql-schema-to-2-1-0.sql, migrate-oracle-schema-to-2-1-0.sql: Adding the scripts that create the new indexes in the DPM tables, and the schema_version table. * ns/: nsmodifygrpmap.c, nsmodifyusrmap.c, nsrmgrpmap.c, nsrmusrmap.c: fix problem with uninitialized variable * h/Cns_server.h: define CNS_MAXNBTHREADS * ns/Imakefile.lfc: Put permissions 644 on lfc.pm and lfc.py. * dpm/Imakefile: Put permissions 644 on dpm.py and dpm.pm. Removed the interfaces man pages, as they don't exist yet. * h/Csec_constants.h: Reduced CSEC_NET_TIMEOUT to 20 seconds * dpm/: dpm_mysql_tbl.sql, dpm_oracle_tbl.sql: add indexes on surl columns of file request tables * DPM-oracle.spec: share/DPM/multiple-domains was not created... * DPM.spec, LFC-oracle.spec, LFC.spec: Replace "make -f..." by "./configure" * LFC.spec: Added the virtualids/VOMS related commands and man pages. Corrected the name of the script to migrate to the virtualids/VOMS LFC. * LFC-oracle.spec: Corrected the names of the script to migrate to the vids/VOMS LFC. * srmv1/srmv1_procreq.c: export delegated credentials in srmCopy call dpm_client_setAutorizationId in advisoryDelete (Jiri) * scripts/LFC-migration-1.4.0/create-uid-gid-mappings.sh: and remove an extra exit 1 * scripts/LFC-migration-1.4.0/: create-local-group-mappings.sh, create-uid-gid-mappings.sh: now does not require a group-map file - it gets the gid's from the db * scripts/LFC-migration-1.4.0/create-uid-gid-mappings.sh: reverted out the gid changes, since they aren't needed * scripts/LFC-migration-1.4.0/create-uid-gid-mappings.sh: added check for group mapping file. Also try to match again gid in group-mappings file * scripts/LFC-migration-1.4.0/: create-local-group-mappings.sh, create-uid-gid-mappings.sh: added groupname to voname mappings file and now use it in the create-uid-gid-mappings * test/dpm/socketSuite: Small fix about socket_Tfile name in special case. * test/srmv2/srmv2Suite: One more fix for PWD and GRP fetch. * socket/dpmcli/dpm-rlsp.c: Small fix on number of args. * scripts/LFC-migration-1.4.0/create-uid-gid-mappings.sh: fixed generation of seq/tables for mysql/oracle * LFC-oracle.spec, LFC.spec: added LFC Migration script * scripts/LFC-migration-1.4.0/: create-uid-gid-mappings.sh, migrate-oracle-schema-to-2-0-0.sql: fix some typos * scripts/LFC-migration-1.4.0/: create-uid-gid-mappings.sh, migrate-mysql-schema-to-2-0-0.sql, migrate-oracle-schema-to-2-0-0.sql, mysql/create-group-mappings-mysql.sh, mysql/migrate-mysql-schema-to-2-0-0.sql, oracle/create-group-mappings-oracle.sh, oracle/migrate-oracle-schema-to-2-0-0.sql: new version combining both mysql and oracle into single script. Now everything is done via the db - no need for lfc-ls * test/dpm/globalSuite: Added 2 new tests for rfcp and globus-url-copy transfers. * dpm/dpm_oracle_ifce.pc: Fix EXPIRE_TIME for UpdateSpace method. * doc/lfc/: INSTALL-client, INSTALL-server-mysql, INSTALL-server-oracle, README: All the documentation in the LFC RPMs now points to the official Wiki documentation. * DPM-oracle.spec, DPM.spec: Added the multiple domain DPM script to the DPNS RPMs. * scripts/multiple-domains/: Common.pm, README, UpdateDpmDatabase.pm, updateDomainName: Adding the updateDomainName script (and dependencies) to the repository. * test/srmv1/srm_testJiri.c: Fixing compilation warnings + WEXITSTATUS. * test/ns/: create_files_rate.c, delete_files_rate.c, query_rate.c: add arguments to starttrans method * test/ns/create_files.c: add arguments to starttrans() * test/dpm/Imakefile: add rules for dpm_testcopy * test/srmv2/srmv2Suite: More fixes for PWD & GRP retrieval (ACL puzzle). * test/dpm/dpm_testcopy.c: Initial release. * test/srmv2/srmv2Suite: Better protection in ACL test phase against bad group definitions. * dpm/Imakefile: add rules for global space reservation methods * test/srmv2/srmv2Suite: One more (small) fix for the ACl issue. * test/srmv2/srmv2Suite: Fixes ACL issue for running srm2_testSetPermission. Comparison issue not fixed yet. * dpm/dpm_copy.c: set delegation flag * dpm/dpm_procreq.c: export delegated credentials for dpm_copy method add processing for global space reservation routines * dpm/dpm_main.c: add processing for global space reservation routines * dpm/dpm_util.c: add function build_proxy_filename * test/srmv2/srm2_testLs.c: Improved UsrP & GrpP printout when multiple occurences. * srmv2/srmv2_xferreq.c: export delegated credentials in srmCopy copy detailed error messages from dpm API * test/srmv2/: srm2_testCopy.c, srm2_testGet.c, srm2_testPut.c: memset reqfilep added. * srmv2/srmv2_dirreq.c: copy detailed error message returned by the dpm_rm API * srmv2/srmv2_spacereq.c: add support for ReserveSpace, UpdateSpace, ReleaseSpace, GetSpaceToken and GetSpaceMetaData * test/srmv2/srmv2Suite: Updates (Space functions) + fixes. * socket/dpmcli/: dpm-gspt.c, dpm-resp.c, dpm-rlsp.c, dpm-spmd.c, dpm-upsp.c, module.mk: New space methods added. * test/dpm/: globalSuite, socketSuite: Small improvements (VOTEAM, /var). * test/srmv1/: srm_testput.c, srmv1Suite: Several improvements (VOTEAM in srmv1Suite). * test/srmv2/srmv2Suite: Implement overwrite mode for testPut + yet another effort for ACL test. Not completed yet. * test/srmv2/srm2_testGetRequestID.c: Tiny cleanup. * test/srmv2/: srm2_testGetSpaceMetaData.c, srm2_testGetSpaceToken.c, srm2_testMkdir.c, srm2_testPut.c, srm2_testReleaseSpace.c, srm2_testReserveSpace.c, srm2_testRm.c, srm2_testUpdateSpace.c: Improvements to many tests, and cleaner pointer management. * dpm/Imakefile, ns/Imakefile.lfc: Using non-specific platform commands to build the interfaces. * config/: aix.cf, sun.cf: Forgot -I in INCLUDE_PERL. Fixed. * h/dpm_server.h: add prototypes for space metadata DB methods * h/dpm_api.h: add prototype for dpm_client_setSecurityOpts() * h/dpm.h: define constants for getspacemd and getspacetoken * dpm/: dpm_mysql_ifce.c, dpm_oracle_ifce.pc: add functions for processing of global space reservation requests * dpm/: send2dpm.c, sendrep.c: add processing for getspacemd and getspacetoken * dpm/: dpm_getspacemd.c, dpm_getspacemd.man, dpm_getspacetoken.c, dpm_getspacetoken.man, dpm_releasespace.c, dpm_releasespace.man, dpm_reservespace.c, dpm_reservespace.man, dpm_updatespace.c, dpm_updatespace.man: Initial release * scripts/choose-module: Put a dm-common) case. * lcg-dm-common.spec: Added the dependency on voms-api RPMs. * dpm/Imakefile, ns/Imakefile.lfc: Replaced "gcc -fpic" by $(CC) * config/aix.cf, config/darwin.cf, config/linux.cf, config/sun.cf, dpm/Imakefile, ns/Imakefile.lfc: Using a different $INCLUDE_PERL depending on the platform. 2005-10-30 15:29 slemaitr - Before tagging 1.4.0 * DPM-oracle.spec, DPM.spec: correct init.d and sysconfig files. * scripts/choose-module: Correct parsing for config/site.def for the DPM * VERSION: Upgrading to version 1.4.0 * dpm/Imakefile: Integrated the DPM Perl and Python interfaces. * ns/Imakefile.lfc: Integrated the LFC Perl and Python interfaces. * DPM-interfaces.spec: Commented the interfaces man pages, as they don't exist yet... * ns/Imakefile: Added $(LFC_IFCE) in the list of files to be removed by "make clobber". * config/Project.tmpl: If BuildInterfaces=YES and BuildNameServerAsLFC=YES (or DPNS) then BuildNameServerLibrary=YES. * config/Imake.tmpl: Added PERLDIR and PYTHONDIR. * config/Library.tmpl: If BuildInterfaces=YES and BuildNameServerAsLFC=YES (or DPNS) then BuildNameServerLibrary=YES. * config/Imake.rules: Defined InstallManPage for the LFC/DPM Perl and Python interfaces man pages. * LFC-oracle.spec, LFC.spec: Included the schema migration scripts (for virtual ids and VOMS support) to the LFC-server-mysql and LFC-server-oracle RPMs. * LFC-oracle.spec: Added lcgdm-mkgridmap and lcgdm-mkgridmap.conf in the LFC-server-oracle RPM. * LFC.spec: Added lcgdm-mkgridmap and lcgdm-mkgridmap.conf in the LFC-server-mysql RPM. * DPM-interfaces.spec: Adding DPM-interfaces.spec to the repository. * DPM.spec: Split DPM.spec and DPM-interfaces.spec * LFC-interfaces.spec: Adding LFC-interfaces.spec to the repository. * LFC.spec: Removed everything related to the Perl and Python interfaces. Removed the site.def parsing, as it has to be done beforehand. * LFC-oracle.spec: Removed the site.def parsing, as it has to be done beforehand. Replaced with in the NSCONFIG template file. Put permissions 644 on the man pages. * DPM-oracle.spec: Replace with in the NSCONFIG and DPMCONFIG template files. * Imakefile: "make rpm" now builds $(PACKAGE).spec and $(PACKAGE)-interfaces.spec for the LFC and the DPM MySQL. * scripts/choose-module: Added BuildInterfaces YES/NO for LFC, DPM and lcg-dm-common. * config/site.def: Added BuildInterfaces and the Install paths for the Perl and Python Interfaces. * lcgdm-mkgridmap/: lcgdm-mkgridmap, lcgdm-mkgridmap.conf: Adding lcgdm-mkgridmap (cron job) and lcgdm-mkgridmap.conf to the repository. * scripts/migrate-oracle-schema-to-2-0-0.sql: Moved file to LFC-migration-1.4.0/oracle. * scripts/LFC-migration-1.4.0/oracle/: create-group-mappings-oracle.sh, migrate-oracle-schema-to-2-0-0.sql: Adding the scripts to migrate to LFC version 1.4.0 to the repository. * scripts/migrate-mysql-schema-to-2-0-0.sql: Moved file to LFC-migration-1.4.0/mysql. * scripts/LFC-migration-1.4.0/mysql/: create-group-mappings-mysql.sh, migrate-mysql-schema-to-2-0-0.sql: Adding the scripts to migrate to LFC version 1.4.0 to the repository. * ns/: lfcdaemon.scripts.mysql, lfcdaemon.scripts.oracle, lfcdaemon.sysconfig.mysql, lfcdaemon.sysconfig.oracle: Adding the possibility to run the LFC in READ-ONLY mode. * ns/dpnsdaemon.scripts, ns/dpnsdaemon.sysconfig, ns/lfcdaemon.scripts, ns/lfcdaemon.sysconfig, srmv1/srmv1.scripts, srmv1/srmv1.sysconfig, srmv2/srmv2.scripts, srmv2/srmv2.sysconfig: Re-splitting the sysconfig and init.d files for Oracle and MySQL... * dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, dpm/dpm.sysconfig.mysql, dpm/dpm.sysconfig.oracle, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/dpnsdaemon.sysconfig.mysql, ns/dpnsdaemon.sysconfig.oracle, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, ns/lfcdaemon.sysconfig.mysql, ns/lfcdaemon.sysconfig.oracle, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv1/srmv1.sysconfig.mysql, srmv1/srmv1.sysconfig.oracle, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle, srmv2/srmv2.sysconfig.mysql, srmv2/srmv2.sysconfig.oracle: Re-splitting the sysconfig and init.d files... * LFC-oracle.spec, LFC.spec: Putting permissions 644 on all the LFC man pages. * ns/Cns_procreq.c: fix Cns_srv_getidmap (array of groupnames) * ns/Cns_getidmap.c: fix typo which prevented to get correct gids (fix provided by Jiri Kosina) * config/site.def: uses $(prefix) instead of /opt/lcg for config files * scripts/: migrate-mysql-schema-to-2-0-0.sql, migrate-oracle-schema-to-2-0-0.sql: Adding the scripts to migrate the LFC database schema to version 2.0.0 (corresponding to the LFC with virtual uids/gids and VOMS support). * ns/Cns_procreq.c: suppress debugging entries in the log * ns/: Cns_getgrpbygid.c, Cns_getgrpbygid.man, Cns_getgrpbynam.c, Cns_getgrpbynam.man, Cns_getusrbynam.c, Cns_getusrbynam.man, Cns_getusrbyuid.c, Cns_getusrbyuid.man: Initial release * config/site.def: add support for virtual id mapping + VOMS * ns/nsdaemon.man: document option for vo mapping file * ns/Cns_main.c: add support for virtual id mapping, VOMS and du method * ns/: Imakefile.dpns, Imakefile.lfc: add rules for virtual id mapping API + CLI add rule for du API * ns/Imakefile: add support for virtual id mapping and VOMS * h/Csec_common.h: add support for VOMS * security/Imakefile, h/Csec_api.h: add support for VOMS * security/Csec_plugin_GSS.c: add support for VOMS * security/Csec_api.c: add support for VOMS * security/: globus_gsi_gss_constants.h, globus_i_gsi_credential.h, gssapi_openssl.h: Added for VOMS support * ns/Cns_procreq.c: check if status pending when requesting write access add support for virtual id mapping add support for du method * ns/: nschown.c, nsgetacl.c, nsls.c, nssetacl.c: add support for virtual id mapping * ns/Cns_du.c: Initial release * ns/: Cns_getidmap.c, Cns_modifygrpmap.c, Cns_modifyusrmap.c, Cns_getidmap.man, Cns_modifygrpmap.man, Cns_modifyusrmap.man, Cns_rmgrpmap.c, Cns_rmgrpmap.man, Cns_rmusrmap.c, Cns_rmusrmap.man, nsmodifygrpmap.c, nsmodifygrpmap.man, nsmodifyusrmap.c, nsmodifyusrmap.man, nsrmgrpmap.c, nsrmgrpmap.man, nsrmusrmap.c, nsrmusrmap.man: Initial release * ns/: Cns_mysql_tbl.sql, Cns_oracle_tbl.sql: add tables and constraints for virtual id mapping * ns/: Cns_mysql_ifce.c, Cns_oracle_ifce.pc: add routines for virtual id mapping * imake/imake.c: include stdlib.h instead of defining proto for malloc/realloc to avoid problems with gcc 3.4 * h/: dpns_api.h, lfc_api.h: add defines for virtual id mapping and du methods * h/Cns_server.h: add structures and DB function prototypes for virtual id mapping * h/Cns_constants.h: add constants for virtual id mapping CLI * h/Cns_api.h: add prototypes for virtual id mapping and du functions * h/Cns.h: add constants for virtual id mapping and du method * rfio/: rfiod.logrotate, rfiod.man, rfiod.scripts, rfiod.sysconfig: Changing logfile from "/var/log/rfiod/log" to "/var/log/rfio/log", to be consistent with RfioSpool in config/site.def. * DPM.spec: Removing the Obsoletes tag for CASTOR-client, to avoid removing it transparently at sites (it should be the site decision). * DPM.spec: CASTOR-client is now obsoleted in the DPM-rfio-server RPM (only, not the other ones). * LFC.spec, ns/Imakefile.lfc: The lfc_mkdir man page is now distributed as well. * rfio/rfiod.scripts: Put back the -f option (which means --logfile, and not --force...) * interfaces/README: Update README after changes on how the LFC-interfaces and DPM-interfaces RPMs are built. * interfaces/LFC-interfaces.spec: Removing LFC-interfaces.spec as LFC-interfaces and DPM-interfaces has been integrated to the main RPM building process. * interfaces/Makefile.rpm: Removing Makefile.rpm, as LFC-interfaces and DPM-interfaces has been integrated to the main RPM building process. * DPM.spec, LFC.spec: Modified the spec files to integrate the $(PACKAGE)-interfaces RPMs. * interfaces/make.sh: Modified make.sh so that it takes the LFC library (and header file) being built, and not the ones already installed on the machine. Added -DCSEC as well. * Imakefile, config/Project.tmpl: Adding interfaces/ to the source directories. * interfaces/dpm.i: Adding to the repository the DPM swig interface created by Jean-Philippe. * interfaces/make-dpm.sh: Adding to the repository the script to build the DPM Perl and Python interfaces. * dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, dpm/dpm.sysconfig.mysql, dpm/dpm.sysconfig.oracle, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/dpnsdaemon.sysconfig.mysql, ns/dpnsdaemon.sysconfig.oracle, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, ns/lfcdaemon.sysconfig.mysql, ns/lfcdaemon.sysconfig.oracle, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv1/srmv1.sysconfig.mysql, srmv1/srmv1.sysconfig.oracle, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle, srmv2/srmv2.sysconfig.mysql, srmv2/srmv2.sysconfig.oracle: The MySQL and Oracle init.d scripts and sysconfig files have merged. Removing the separate ones. * DPM-oracle.spec, DPM.spec, LFC-oracle.spec, LFC.spec, dpm/dpm.scripts, dpm/dpm.sysconfig, ns/dpnsdaemon.scripts, ns/dpnsdaemon.sysconfig, ns/lfcdaemon.scripts, ns/lfcdaemon.sysconfig, srmv1/srmv1.scripts, srmv1/srmv1.sysconfig, srmv2/srmv2.scripts, srmv2/srmv2.sysconfig: Merged the MySQL and Oracle init.d scripts and sysconfig files. * security/Csec_protocol_policy.c: reset serrno after failed getconfent to get proper error messages in RFIO * DPM.spec, LFC.spec, ns/Imakefile.dpns: Made sure that the transaction and session man pages are provided by the RPMs. * srmv1/srmv1.scripts.oracle: The "su -s..." was missing in the srmv1 init.d script. * security/Csec_plugin_GSS.c: Jean-Philippe fixed a bug that was making the build fail under RH7.3 (the variable declaration was not coming first, which was not a problem under SLC3...) * dli/lfc-dli.sysconfig, dpm/dpm.sysconfig.mysql, ns/dpnsdaemon.sysconfig.mysql, ns/lfcdaemon.sysconfig.mysql, rfio/rfiod.sysconfig, srmv1/srmv1.sysconfig.mysql, srmv2/srmv2.sysconfig.mysql: Added "export" in the sysconfig files where missing. * dpm/dpm.scripts.oracle, dpm/dpm.sysconfig.oracle, ns/dpnsdaemon.scripts.oracle, ns/dpnsdaemon.sysconfig.oracle, ns/lfcdaemon.sysconfig.oracle, srmv1/srmv1.scripts.oracle, srmv1/srmv1.sysconfig.oracle, srmv2/srmv2.sysconfig.oracle: Fixed the environment variables in the init.d and sysconfig files for Oracle (LFC and DPM). 2005-09-26 14:28 slemaitr - Before (re)tagging 1.3.8 * dpm/dpm-qryconf.c: correct display of status in case several filesystems have a non zero status * srmv2/: srmv2_dirreq.c, srmv2_permreq.c: protect against NULL pointers in the requests * srmv2/srmv2_xferreq.c: protect against NULL pointers in the requests * srmv1/srmv1_procreq.c: protect against NULL pointers in the requests * dli/lfc-dli.sysconfig, ns/dpnsdaemon.sysconfig.mysql, ns/dpnsdaemon.sysconfig.oracle, ns/lfcdaemon.sysconfig.mysql, ns/lfcdaemon.sysconfig.oracle, srmv1/srmv1.scripts.oracle, srmv1/srmv1.sysconfig.mysql, srmv1/srmv1.sysconfig.oracle, srmv2/srmv2.scripts.oracle, srmv2/srmv2.sysconfig.mysql, srmv2/srmv2.sysconfig.oracle: Made sure that GRIDMAP appeared in Oracle and MySQL init.d scripts and sysconfig files, whereever it was needed. * ns/dpnsdaemon.scripts.oracle: Added "export GRIDMAP=..." that was missing and prevented the Oracle DPNS to work. Put a correct TNS_ADMIN as well. * dpm/dpm.scripts.oracle: Put the right numbers for chkconfig. * interfaces/: lfc.3pm, lfc.3py: Remove error checking from listreplicas in the examples * interfaces/: LFC-interfaces.spec, Makefile.rpm, lfc.3pm, lfc.3py, lfc.i: Added perl/python interface manpages, and modified lfc.i to add some missing castor/cns constants * ns/lfc.i: this file is now in the "interfaces" directory * interfaces/lfc.i: Added sstrerror() to swig interface file * DPM-oracle.spec: Fixed a bug where the Oracle RPMs were built against MySQL... * dpm/: dpm_main.c, dpm_mysql_ifce.c, dpm_oracle_ifce.pc, dpm_procreq.c: fix free space leaks * dpm/poolmgr.c: fix free space leaks add support for large filesystems * dpm/dpm_proclreq.c: fix free space leak correct processing of "overwrite" option of PrepareToPut * h/dpm_server.h: add missing function prototypes * h/rfio_api.h: add support for rfio_statfs64 * rfio/rfio_callhandlers.c: include rfio_api.h * rfio/rfio_HsmIf.c: for rfio_unlink, call dpm_rm instead of Cns_unlink * rfio/Imakefile: add rules for rfio_statfs64 man page and rfdf module * rfio/rfdf.c: Initial release * rfio/: rfio_call64.c, rfio_serv.c, rfio_statfs.man, rfio_statfs64.man, rfstatfs.c, statfs.c: add rfio_statfs64 method * dli/lfc-dli.sysconfig, dpm/dpm.sysconfig.mysql, dpm/dpm.sysconfig.oracle, ns/lfcdaemon.sysconfig.mysql, ns/lfcdaemon.sysconfig.oracle, srmv1/srmv1.sysconfig.mysql, srmv1/srmv1.sysconfig.oracle: Removed the possibility to specify another user than "lfcmgr" or "dpmmgr". * dli/dli.c: protect against NULL type or data arguments * dpm/: dpm-addpool.c, dpm-modifypool.c: include "u64subr.h" to correctly support defsize > 2GB * test/: dpm/globalSuite, dpm/socketSuite, srmv2/srmv2Suite: Several improvements (to get rid of CounterFile+File, and ACL tests in srmv2). * dpm/: dpm.scripts.mysql, dpm.scripts.oracle: On insisting Sophie's request, fix problem of 'service stop + restart'. * dpm/dpm.scripts.mysql: Fix a bug in the while loop syntax. * dpm/dpm.scripts.oracle: Fix a bug in the while loop. * dpm/dpm.scripts.oracle: Adding a wait loop in the bottom of the "stop" command. * test/srmv2/srm2_testPut.c: Add overWrite feature. * test/srmv2/srmv2Suite: Insert overWrite test + several other things. * test/dpm/globalSuite: Improve PATH definition + many other small things (LFC_HOST), ...) * dpm/dpm.scripts.mysql: Insert a wait loop at the bottom of the stop command (dpm dies very slowly ;-). * dli/lfc-dli.scripts, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle: Fixing bug #10616 : made sure that the exact process name is started/stopped/statused. * rfio/rfiod.scripts: Removed the "-f" force option. And fixed bug #10616: made sure that the right process name is used when issuing "service ... stop". * dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle: Fixing bug #10616 : made sure that the right process name is used when issuing "service ... stop". * dpm/dpm.man, dpm/dpm_main.c, dpm/dpm_mysql_ifce.c, dpm/dpm_oracle_ifce.pc, dpm/dpm_proclreq.c, h/Cns_server.h, h/dpm_server.h, ns/Cns_main.c, ns/Cns_mysql_ifce.c, ns/Cns_oracle_ifce.pc, ns/nsdaemon.man, srmv1/srmv1.c, srmv1/srmv1.man, srmv1/srmv1_procreq.c, srmv2/srmv2.c, srmv2/srmv2.man, srmv2/srmv2_xferreq.c: make the DB name configurable by adding the DB name to the CONFIG files * dpm/dpm-modifyfs.man: The status can be either alphanumeric or the corresponding numeric value * CHANGES, h/Csec_common.h, h/Csec_plugin.h, security/Csec_api.c, security/Csec_errmsg.c, security/Csec_plugin_GSS.c, security/Csec_plugin_ID.c, security/Csec_plugin_KRB4.c: Added checks on client identity in Csec for service certificates * dpm/poolmgr.c: fix dpm_modfsinpoolconf and dpm_rmfsfrompoolconf when there are several filesystems in a pool * ns/lfcdaemon.sysconfig.mysql: fix typo: /var/log/dpns/log --> /var/log/lfc/log * test/dpm/globalSuite: Improve failure detection when mkdir operations. - CHANGES added by David Smith : 2005-09-22 13:30 dhsmith * interfaces/: LFC-interfaces.spec, Makefile.rpm, lfc.3pm, lfc.3py, lfc.i Added man pages for perl/python interfaces, added sstrerror() and some cns/castor constants to the interface file. 2005-08-04 15:10 dhsmith * security/: Csec_api.c, Csec_errmsg.c, Csec_plugin_GSS.c, Csec_plugin_ID.c, Csec_plugin_KRB4.c h/: Csec_common.h, Csec_plugin.h For GSI/KRB5 added check on the server to verify the client identity if Csec_isIdAService() claims the peer's DN is a service identity. (eg. host certifiate) 2005-07-26 14:32 slemaitr - Before tagging 1.3.7 : * ns/: Cns_addreplica.man, Cns_delreplica.man, Cns_procreq.c: change authorization needed for addreplica (READ) and delreplica (WRITE) (only the owner of the file entry used to be able to add/remove replicas) * test/dpm/globalSuite: Improve LFC_HOME default. * test/dpm/globalSuite: gfal_unlink revival. * test/dpm/globalSuite: Implement filtering on the lcg-cr command. 2005-07-22 11:46 baud - Before tagging 1.3.6 : * ns/: Cns_mysql_ifce.c, Cns_oracle_ifce.pc: fix invalid column name in Cns_list_rep4admin routine * ns/Cns_procreq.c: uses RETURNQ instead of RETURN everywhere in processing of statg * ns/Cns_oracle_ifce.pc: fix func array size in Cns_get_fmd_by_guid() * ns/Cns_readdirg.man: added structure layout * ns/: Cns_listreplica.man, Cns_listreplicax.man: added structure layout and example * interfaces/: LFC-interfaces.spec, Makefile.rpm, README, lfc.i, make.sh: Moved interface/python to interface/ and added perl ifce. * test/dpm/globalSuite: Fix some domain name issues + PATH fixes as well. * common/Cdomainname.c: accept tabs as well as blanks as separator take first value of the "search" line if there are several values * dpm/dpm-modifypool.c: initialize startthresh and stopthresh to -1 (which means value unchanged) * test/: dpm/socketSuite, srmv1/srmv1Suite, srmv2/srmv2Suite: Implemented correct site_domain parsing + other small fixes. * test/srmv2/srm2_testPut.c: Fix f_type vector issue for multifile request. * test/srmv2/srmv2Suite: Implemented the "Collision on testMv" test (Internal Error). * test/dpm/globalSuite: Fix for extra params in gfal_test.c. * test/srmv2/srmv2Suite: Fix in testSetPermissions section. 2005-07-14 10:53 slemaitr - Before tagging 1.3.5 : * scripts/RLS-Atlas-migration/: README, bin/Makefile, bin/migrate_RLS_entries, bin/migrate_data_atlas, bin/migrate_files, bin/migrate_files.c, bin/migrate_files.c.bak, bin/migrate_files.o, bin/migrate_info, bin/migrate_info.c, bin/migrate_info.o, bin/migrate_path, bin/migrate_path.c, bin/migrate_path.o, lib/Atlas.pm, lib/Common.pm, lib/QueryAndUpdate.pm: Adding the RLS -> LFC migration code for Atlas to the repository. * interfaces/python/: Makefile.rpm, lfc.i, make.sh: Added the changes required by LHCb. * interfaces/python/: lfc_errno.h, lfc_errno.c: Adding the modifications required by LHCb. * test/dpm/globalSuite: First version of globalSuite * interfaces/python/LFC-python-interface.spec: Removing lfc.pyc (this file only appears when the python interface is actually used...) * socket/dpmcli/dpm-rm.c: Some improvements suggested by JPB. GG. * test/srmv1/: my_dccp_in.sh, my_dccp_out.sh, my_gsiftp_in.sh, my_gsiftp_out.sh, my_rfcp_in.sh, my_rfcp_out.sh, srm_testJiri.c, srmv1Suite: Some tuning to cope with globalSuite. GG. * interfaces/python/: LFC-python-interface.spec, Makefile.rpm, README, lfc.i, make.sh: Adding everything needed to build the LFC python interface to the repository. * srmv1/srmv1_procreq.c: avoid crash when dCache srm-cp sets file status to "Done" to abort a "Copy" request * h/Cns.h: define CNS_STARTSESS and CNS_ENDSESS * h/Cns_api.h: add prototypes for functions Cns_startsess and Cns_endsess change prototype of Cns_starttrans (adding comment field) * h/: dpns_api.h, lfc_api.h: add defines for startsess and endsess * ns/Cns_procreq.c: do not convert guids to lower case (LHCb request) * ns/: Cns_creat.man, Cns_creatg.man, Cns_rename.man, Cns_unlink.man: document the EEXIST error * ns/Cns_procreq.c: add sessions and read-only mode get/log "comment" in starttrans return EEXIST if rename to existing file having disk replicas * ns/Cns_main.c: add sessions and read-only mode * ns/nsdaemon.man: document new option -r (read-only mode) * ns/: Imakefile.cns, Imakefile.dpns, Imakefile.lfc: add rules for startsess and endsess * ns/: Cns_starttrans.c, Cns_starttrans.man: add "comment" to argument list to be able to log in the server the client application name/version * ns/: Cns_endsess.c, Cns_endsess.man, Cns_startsess.c, Cns_startsess.man, lfc.i: Initial release * config/site.def: define LocalHostsList * test/srmv2/srmv2Suite: Added one more cross-check to get a Perm file in the summary status. 2005-06-16 14:54 slemaitr - Before tagging 1.3.4 : * security: Csec_api_loader.c, Csec_static_loader.c, Csec_plugin_GSS.c, Csec_api_loader.c, Csec_common.c h: Csec_plugin.h Add include for unistd.h Change some debug format strings Fix method of storing the function pointers of the selected plugin module * dpm/Imakefile, ns/Imakefile: Add dependency on globus_gssapi_gsi, globus_gss_assist for daemons built with BuildSecurity and UseGSI: This avoids a problem from a conflict between SSL BN_* routines from the oracle library libnnz10 and libcrypto versions of those routines used by globus. 2005-06-15 13:31 slemaitr - Before tagging 1.3.3 : * test/: dpm/socketStress, srmv1/srmv1Stress, srmv2/srmv2Stress: Homogeneous calls for all Stress suites. * srmv1/srmv1_procreq.c, srmv2/srmv2_xferreq.c: do not queue Get/Put request if no valid protocol found in the request * scripts/lcg-info-dynamic-dpm: Moved lcg-info-dynamic-dpm to the DPM-info-dynamic/ directory. * scripts/DPM-info-dynamic/: Makefile.rpm, VERSION, lcg-info-dynamic-dpm, lcg-info-dynamic-dpm.spec: Adding Makefile, spec file, script and VERSION file to build the lcg-info-dynamic-dpm RPM to the repository. * security/Csec_api_loader.c: Fix in try_activate * security/Csec_api_loader.c: Change for func passing in Csec * h/Csec_plugin.h: Change related to func passing in Csec * CHANGES, config/darwin.cf, config/linux.cf, dli/Imakefile, h/Csec_common.h, h/Csec_plugin.h, security/Csec_api_loader.c, security/Csec_common.c, security/Csec_plugin_GSS.c, security/Csec_plugin_GSS_mapper.c, security/Csec_plugin_ID.c, security/Csec_plugin_KRB4.c, security/Csec_static_loader.c, security/Imakefile, srmv1/Imakefile, srmv2/Imakefile, test/srmv1/Imakefile, test/srmv2/Imakefile: Pass func ptrs from CSEC API to csec plugins, plus few config changes * dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, rfio/rfiod.scripts, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle: The ps corresponds to the right daemon name (dpm got mixed with dpm.ftpd...) * DPM-oracle.spec, DPM.spec, LFC-oracle.spec, LFC.spec: The RPMs now install template sysconfig files, so that the admin doesn't have to re-edit them after an RPM upgrade/change. * dpm/dpm.scripts.mysql: Removing "umask 0022" at the very end of start). * dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, rfio/rfiod.scripts, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle: Modified the chkconfig in the init.d scripts : RFIO should be started after the DPNS and before the DPM (if they are installed onthe same machine). Oracle and MySQL init.d scripts now have the same "chkconfig" line as well... * LFC-oracle.spec: Added @OS@, so that the RPM name contains "_sl3" or not. * dli/lfc-dli.scripts: Added "chkconfig 345 67 38" : the DLI server has to be started after the lfcdaemon and stopped before it. * LFC-oracle.spec, LFC.spec: The DLI is now provided in the LFC-server RPM. * dli/: lfc-dli.logrotate, lfc-dli.scripts, lfc-dli.sysconfig: Adding the DLI sysconfig, init.d script and logrotate file to the repository. * scripts/choose-module: Adding the BuildDLI parsing : YES for the LFC and NO for the DPNS. * dpm/dpm.sysconfig.oracle, ns/dpnsdaemon.sysconfig.oracle, srmv1/srmv1.sysconfig.oracle, srmv2/srmv2.sysconfig.oracle: Removed $HOME/.tnsadmin to be a possible location for $TNS_ADMIN, because it won't be passed. * dli/Imakefile: take liblfc from ../lib * ns/Cns_acl.c: fix group permissions in "chmod" routine when there is no default acl mask * ns/Cns_procreq.c: fix chown processing (was calling Cns_acl_chmod instead of Cns_acl_chown) * config/site.def: fix typo in BuildDLI (was BuildDli in site.def and BuildDLI in Project.tmpl) * dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle: Fixed bug #8861: moved $X509_USER_CERT and $X509_USER_KEY to start) only, to avoid the security error when running "service lfcdaemon stop". * dli/dli_testlistReplicas.c: use new wsdl definitions * dli/dli.c: use new wsdl definitions * dli/Imakefile: generate automatically the header file from the wsdl * dli/DataLocationInterface.h: is now automatically generated from the wsdl * dli/DataLocationInterface.wsdl: new wsdl from Heinz * ns/Cns_acl.c: fix group permissions in "inherit" routine when there is no default acl mask (bug 8858) * dpm/Imakefile, ns/Imakefile, srmv1/Imakefile, srmv2/Imakefile: use MySQLLocation * DPM-oracle.spec, DPM.spec, Imakefile, LFC-oracle.spec, LFC.spec: Removed dependency on CGSI_gSOAP. Added @VERSION@ for lcg-dm-common, DPM-client. 2005-06-11 01:00 dhsmith * security: Csec_api_loader.c, Csec_common.c, Csec_plugin_GSS.c, Csec_plugin_GSS_mapper.c, Csec_plugin_ID.c, Csec_plugin_KRB4.c, Csec_static_loader.c, Csec_common.h, Csec_plugin.h Passing function pointers to CSEC plugins for external functions Small change to make error messages more informative on credential acquire fail Write network packet header and data in one call Added network timeout to network reads for packet header as well as data * Imakefile: dli/Imakefile, security/Imakefile, srmv1/Imakefile, srmv2/Imakefile, test/srmv1/Imakefile, test/srmv2/Imakefile Concatenate in preprocessor with __CONCAT() rather than /**/ for GLOBUS_FLAVOUR * config: darwin.cf, linux.cf Added some SHLIBLDFLAGS for darwin Removed 'rdynamic' from LDFLAGS for linux 2005-05-25 14:50 slemaitr - Before tagging 1.3.2 : * VERSION: Upgrading version to 1.3.2 before tagging. * scripts/cvs2cl: Putting cvs2cl in the scripts/ directory instead of in the top directory. * test/: dpm/socketSuite, srmv2/srmv2Stress, srmv2/srmv2Suite: Improvements to stick to new syntax for GridFTP transfers (new DPM aware GridFTP). * test/srmv1/: srm_testJiri.c, srmv1Stress, srmv1Suite: Several fixes and updates, esp. to allow for Castor and Dcap node testing. * test/srmv1/: my_dccp_in.sh, my_dccp_out.sh, my_gsiftp_in.sh, my_gsiftp_out.sh, my_rfcp_out.sh: New versions compatible with new DPM aware GridFTP. Also dcap protocol works within srmv1Suite. * rfio/rfiod.scripts: Removing the -d option when starting rfiod. This is only a debugging option, that makes the startup script hang. * LFC-oracle.spec: Not using $user_tablespace in the DB schema anymore, so not packaging the .templ anymore. * ns/Cns_oracle_tbl.sql.templ: Removing Cns_oracle_tbl.sql.templ (following Miguel's advice not to use $user_tablespace in the schema). * scripts/create-schema-lfc: The schema doesn't have the $user_tablespace variable anymore. Modified the script accordingly. * LFC-oracle.spec, LFC.spec: Obsoletes only CSEC, and not CASTOR-client anymore, as it can be needed by other components than the LFC. Plus small other changes. * DPM.spec, DPM-oracle.spec: DPM-srm-server RPM depends on CGSI-gSOAP. And small other changes. * dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, dpm/dpm.sysconfig.mysql, dpm/dpm.sysconfig.oracle, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/dpnsdaemon.sysconfig.oracle, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, ns/lfcdaemon.sysconfig.oracle, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv1/srmv1.sysconfig.mysql, srmv1/srmv1.sysconfig.oracle, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle: The init.d scripts are more homogeneous now. And the DPM ones don't create the dpmmgr user anymore. * rfio/: rfiod.scripts, rfiod.sysconfig: Added an RFIO log (/var/log/rfiod/log). The daemon is now started with the following options : -sld -f /var/log/rfiod/rfiod.log * config/site.def: define MySQLLocation and NfsRoot * CHANGES, config/site.def, dli/Imakefile, security/Imakefile, srmv1/Imakefile, srmv2/Imakefile, test/srmv1/Imakefile, test/srmv2/Imakefile: Rearrange globus/security settings between site.def and various Imakefiles * dpm/dpm_mysql_ifce.c: fix bug in dpm_unique_id (was returning 3 instead of 1 for the first call) * dpm/poolmgr.c: do not select an empty pool in selectfs * CHANGES, security/Csec_plugin_GSS.c: Change include <> to include "" in Csec_plugin_GSS.c * security/Csec_api.c: include * rfio/: rfio_call64.c, rfio_calls.c: set umask to zero before creating a DPM managed file * CHANGES, lcg-dm-common.spec, config/linux.cf, config/site.def, dli/Imakefile, dpm/Imakefile, lib/Imakefile, ns/Imakefile, security/Imakefile, shlib/Imakefile, srmv1/Imakefile, srmv2/Imakefile, test/dpm/Imakefile, test/srmv1/Imakefile, test/srmv2/Imakefile: Move all the GLOBUS defines to site.def, remove common lib dependnecy from Csec, added rdyanmic to LDFLAGS for linux * srmv2/srmv2_xferreq.c: fix memory leaks in getRequestId, getStatusOfCopyRequest, getStatusOfGetRequest, getStatusOfPutRequest, PutDone * srmv2/srmv2_dirreq.c: fix memory leaks in srmRm * srmv1/srmv1_procreq.c: fix memory leaks in setFileStatus and advisoryDelete * h/dpm_api.h: add prototypes for dpm_free_cfilest, dpm_free_filest, dpm_free_gfilest and dpm_free_pfilest * dpm/Imakefile: add dpm_freefilestatuses * dpm/dpm_freefilestatuses.c: Initial releae * DPM-oracle.spec: Removed the /sbin/chkconfig --del (this is done automatically when the RPM is removed). The SRM servers depend on DPM-client. * LFC-oracle.spec: Removed the /sbin/chkconfig --del lfcdaemon (this is done automatically when the RPM is removed). * DPM.spec: Added /sbin/chkconfig --add for all the daemons. The SRM servers depend on DPM-client. * LFC.spec: Removing /sbin/chkconfig --del lfcdaemon (this is done automatically when removing the RPM). * ns/: lfcdaemon.scripts.mysql, lfcdaemon.scripts.oracle: Added X509_USER_CERT and X509_USER_KEY. Changed $DAEMON --user with "su -c ...", because --user doesn't pass the environment variables set in the script. * LFC-oracle.spec, LFC.spec: Adding "Obsoletes: CASTOR-client, CSEC" for each LFC RPM, so that CASTOR-client and CSEC are automatically removed when upgrading to the new LFC, that depends only on lcg-dm-common. * h/rfio_api.h: define rfio_api_thread_info structure and prototypes for rfio_client_getAuthorizationId() and rfio_client_setAuthorizationId() * rfio/Imakefile: add rfio_apiinit and rfio_auth * rfio/connect.c: pass AuthorizationId from client to server * rfio/: rfio_apiinit.c, rfio_auth.c: Initial release * dli/dli.c: return sfn instead of host * Imakefile, config/Library.tmpl, config/Project.tmpl: add DLI * config/site.def: add DLI * dli/lfc-dli.man: Initial release * dli/dli.c: remove unnecessary lines * h/dli_server.h: Initial release * dli/: DataLocationInterface.h, DataLocationInterface.wsdl, Imakefile, dli.c, dli_testlistReplicas.c, dlilogit.c: Initial release * dpm/dpm.scripts.mysql: Fix wrong umask syntax. GG. * srmv1/srmv1_procreq.c: avoid server crash when "Invalid state" provided for a setFileStatus, for example when srm-cp sets the status to "Done" without having set the status to "Running" beforehand. This is contrary to SRMv1 spec. * security/Csec_plugin_ID.c: Replace getpwuid() with Cgetpwuid() in ID pluggin * test/: dpm/socketSuite, srmv2/srmv2Stress, srmv2/srmv2Suite: Added timestamps almost everywhere. GG. * test/: Imakefile, dpm/Imakefile, srmv1/Imakefile, srmv2/Imakefile: Implement all install stuff into test dirs (for RPM build). GG. * socket/dpmcli/module.mk: Fixing the install path. * scripts/lcg-info-dynamic-dpm: Update and new syntax for the VO dependent args. * test/: dpm/socketSuite, srmv2/srmv2Suite: The gridftp transfert is back on track + Improvements in socket suite. * dpm/dpm.scripts.mysql: Small fix on umask default value. * ns/: lfcdaemon.scripts.mysql, lfcdaemon.scripts.oracle, lfcdaemon.sysconfig.mysql, lfcdaemon.sysconfig.oracle: Added the GRIDMAP variable. * LFC-oracle.spec, LFC.spec: Adding pre- and post-install scripts that do a "chkconfig --add lfcdaemon" or "chkconfig --del lfcdaemon". * rfio/rfio_HsmIf.c: re-enable rfio_HsmIf_GetHsmType code (needed for close of /dpm files) * dpm/dpm.scripts.mysql: For the DPM, umask must be set to 0. GG * scripts/choose-module: Removed the lines with MySQL/Oracle for the second argument of the script. * dpm/dpm.scripts.mysql, ns/dpnsdaemon.scripts.mysql, srmv1/srmv1.scripts.mysql, srmv2/srmv2.scripts.mysql: Fixing chkconfig parameters. GG. * dpm/dpm.scripts.mysql, ns/dpnsdaemon.scripts.mysql, rfio/rfiod.scripts, srmv1/srmv1.scripts.mysql, srmv2/srmv2.scripts.mysql: Improvement to deamon launching command. GG. * dpm/dpm.scripts.mysql, ns/dpnsdaemon.scripts.mysql, rfio/rfiod.scripts, srmv1/srmv1.scripts.mysql, srmv2/srmv2.scripts.mysql: Fixed env. transfer to the daemons. * dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle: use correct port number * lcg-dm-common.spec: add: "Provides: liblcg-dm-common.so" * lcg-dm-common.spec, scripts/choose-module: DPNS should be NO for lcg-dm-common * DPM.spec: install rfcntl.h * h/Imakefile: install rfio header files 2005-05-24 13:00 dhsmith * Csec_plugin_GSS.c: Change include of "openssl/ssl.h" to user include rather than system include. * lcg-dm-common.spec: Remove liblcg-dm-common.so from lcg-dm-common.spec * lib/Imakefile, shlib/Imakefile: Remove liblcg-dm-common.so targets * site.def: Added definitions for GlobusLocation and GlobusFlavour Remove some detailed definitions relating to security * security/Imakefile: Remove superfluous 'rdynamic' flag Remove dependencies on TopLibraryNam Link Csec security pluggins with $(SHLIBREQLIBS) rather than $(LIBS) Moved various definitions from site.def * linux.cf: Add 'rdynamic' to LDFLAGS for linux.cf * dli/Imakefile, srmv1/Imakefile, srmv2/Imakefile, test/srmv1/Imakefile, test/srmv2/Imakefile: Setup globus paths and flavour from settings in site.def * dpm/Imakefile, test/dpm/Imakefile, ns/Imakefile: Remove globus library dependence from LIBCSEC 2005-05-04 11:54 baud - Before tagging 1.3.1 : * CHANGES: Commiting changes before tagging 1.3.1. * VERSION: version 1.3.1 * srmv1/srmv1_procreq.c: sfnfromsurl return NULL and not -1 in case of failure * rfio/rfio_HsmIf.c: externalize function AddCnsFileDescriptor as rfio_HsmIf_AddCnsFileDescriptor * DPM.spec: distribute rfio header files * h/rfio_rfilefdt.h: define internal/external prototypes depending on RFIO_KERNEL * h/rfio.h: add support for applications compiled with _FILE_OFFSET_BITS=64 or _LARGE_FILES * Imakefile, lcg-dm-common.spec, config/site.def, lib/Imakefile, shlib/Imakefile: fix production of lcg-dm-common * rfio/rfio_callhandlers.c: adapt Cns_client_setAuthorizationId calls to the prototype * h/: Cns_api.h, dpm_api.h, dpns_api.h, lfc_api.h: add prototype for xxx_client_getAuthorizationId and xxx_client_setAuthorizationId * rfio/rfiod.sysconfig: Removed the DPM_HOST. Only the DPNS_HOST has to be set to run RFIO. 2005-04-29 11:34 slemaitr - Before tagging 1.3.0 : * CHANGES: Commiting changes before tagging 1.3.0. * VERSION: Upgrading version to 1.3.0 before tagging. * DPM.spec: Adding /lib to the ld conf file. * DPM.spec: Distributing the rfiod init.d scripts. * lcg-dm-common.spec: Better spec file. * Imakefile: Added Jean-Philippe's solution to handle the lcg-dm-common RPM correctly. * rfio/rfiod.scripts: The rfiod daemon is installed in /opt/lcg/bin. * scripts/choose-module: Modified to handle the lcg-dm-common module as well. * Imakefile: Added a new $PACKAGE = lcg-dm-common. * ns/Cupv_check.c: include either Cupv.h or Cns.h and not both to avoid warnings on SLC3 * CHANGES: More changes. * lcg-dm-common.spec: The lcg-dm-common gets built on SLC3 too now. * CHANGES: Adding last changes. * lcg-dm-common.spec: The lcg-dm-common gets built on SLC3 too now. * Imakefile: The "rpm" target creates the lcg-dm-common RPM as well as the LFC or DPM one. * CHANGES: Adding recent changes before really tagging 1.3.0. * DPM.spec: Not distributing the RFIO init.d script for the moment. * srmv1/srmv1.man, srmv2/srmv2.man: The log file is now : /var/log/srmv1/log or /var/log/srmv2/log instead of /var/log/dpm/log. * DPM-oracle.spec, DPM.spec, LFC-oracle.spec, LFC.spec: The DPM and LFC RPMs will depend on the lcg-dm-common one. They don't provide the security libraries anymore, as lcg-dm-common does. * lcg-dm-common.spec: Adding the lcg-dm-common spec file to the repository. * h/Imakefile: The Castor_limits and serrno man pages are now installed and parsed (FILTERMANPAGE macro) by the "install.man" target. * LFC-oracle.spec: "create-schema-lfc" instead of "create-schema". * DPM.spec, LFC.spec, ns/Imakefile.cns, ns/Imakefile.dpns, ns/Imakefile.lfc: Added the following man pages : Cns_lchown, Cns_setrstatus, Cns_setratime, Cns_setptime, Cns_listreplicax and Cns_listrep4gc. * config/site.def: no need to have the SRM spool definitions conditional * ns/Cns_lchown.man: Initial release * ns/Cns_statg.man: add documentation for sfn * ns/: Cns_listrep4gc.man, Cns_listreplicax.man: Initial release * rfio/: rfiod.scripts, rfiod.sysconfig: Added environment variables that are needed to run the RFIO daemon. * dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, dpm/dpm.sysconfig.mysql, dpm/dpm.sysconfig.oracle, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/dpnsdaemon.sysconfig.mysql, ns/dpnsdaemon.sysconfig.oracle, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv1/srmv1.sysconfig.mysql, srmv1/srmv1.sysconfig.oracle, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle, srmv2/srmv2.sysconfig.mysql, srmv2/srmv2.sysconfig.oracle: Removed the possibility to run the daemons as another user than "dpmmgr". The "dpmmgr" user is created when running the scripts, if it doesn't already exist. * DPM-oracle.spec, DPM.spec: The daemons installed have to be owned by root, and not by "dpmmgr". * DPM-oracle.spec, DPM.spec: Ignoring the warnings on SLC3 when building the RPMs. * ns/Cns_statr.man: Referencing to the Cns_statg man page. * scripts/filter-manpage.sh: The ".so" man pages are now handled properly. * dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, dpm/dpm.sysconfig.mysql, dpm/dpm.sysconfig.oracle, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv1/srmv1.sysconfig.mysql, srmv1/srmv1.sysconfig.oracle, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle, srmv2/srmv2.sysconfig.mysql, srmv2/srmv2.sysconfig.oracle: Added used environment variables. * ns/Cns_setfsizeg.man: document valid values for csumtype * ns/Cupv_check.c: #ifdef instead of #ifndef. * ns/: Cns_setptime.man, Cns_setratime.man, Cns_setrstatus.man: Initial release * ns/Cns_procreq.c: correct check on sfn length in setptime, setratime, setrstatus * doc/lfc/: INSTALL-client, INSTALL-server-mysql, INSTALL-server-oracle: Refering to the "LFC Administrator's Guide" to avoid duplicated work. * ns/Cupv_check.c: Rechecking in the merge... * srmv2/srmv2.sysconfig.oracle: Adding srmv2.sysconfig.oracle to the repository. * srmv1/srmv1.sysconfig.oracle: Adding srmv1.sysconfig.oracle to the repository. * DPM-oracle.spec: The post install scripts were not refering to the right RPMs. * test/: dpm/socketStress, dpm/stressSuite, srmv1/srmv1Stress, srmv2/srmv2Stress, srmv2/stressSuite: Added stress scripts for the 3 servers. * h/: dpns_api.h, lfc_api.h: fix mapping of Cns_rewinddir * dpm/dpm_proclreq.c: re-increment the request counter in case get_next_req fails (race condition) * socket/: dpmcli/module.mk, Makefile: These new versions are install and rpm aware. GG. * test/srmv2/: srm2_testGet.c, srm2_testPut.c: Fixes for NULLing storageSystemInfo. * ns/Cns_setfsizeg.man: Removed what didn't correspond to Cns_setfsizeg, but to Cns_setfsize. * DPM-oracle.spec: Removed the RPMs that were not depending on Oracle. Added the init.d scripts, the logrotate and sysconfig files. Changed the post install messages. * DPM.spec: Changed the message appearing after the installation of the SRM servers. * DPM.spec: Added the init.d scripts, logrotate and sysconfig files in the SRM server RPM. * ns/: lfcdaemon.scripts.mysql, lfcdaemon.scripts.oracle, lfcdaemon.sysconfig.mysql, lfcdaemon.sysconfig.oracle: The LFC user/group is now "lfcmgr". * srmv1/srmv1.logrotate, srmv1/srmv1.scripts.mysql, srmv1/srmv1.scripts.oracle, srmv1/srmv1.sysconfig.mysql, srmv2/srmv2.logrotate, srmv2/srmv2.scripts.mysql, srmv2/srmv2.scripts.oracle, srmv2/srmv2.sysconfig.mysql: Adding the init.d scripts, sysconfig and logrotate files to the repository. * config/site.def, srmv1/Imakefile, srmv2/Imakefile: The log files of the SRMv1 and SRMv2 servers are now located in /var/log/srmv1 and /var/log/srmv2 instead of /var/log/dpm. * security/Imakefile: Added the "install.man" target. It installs the Csec_api man page. * ns/Imakefile.lfc: Adding the lfc_setfsizeg man page. * LFC.spec: Adding the lfc_setfsizeg man page. Adding that the LFC daemon will be run as "lfcmgr". * ns/Cns_setfsizeg.man: Adding the Cns_setfsizeg man page to the repository. * LFC.spec, LFC-oracle.spec: Adding that the LFC daemon will be run as "lfcmgr". * LFC.spec, LFC-oracle.spec: Removed the CASTOR-client dependency. * scripts/filter-manpage.sh: All the "CASTOR" words are replaced by "LCG" now. * scripts/filter-manpage.sh: The man pages from the common/ directory are also parsed now. Also added more parsing for the lfc-setacl man page. * common/Imakefile: Using the FILTERMANPAGE macro for the common/ man pages. * cvs2cl: Adding "cvs2cl" to the repository. It gets all the changes that have been done in CVS since the beginning. * DPM-oracle.spec: The dpm, dpnsdaemon, srmv1 and srmv2 daemons are owned by "dpmmgr:dpmmgr". * DPM.spec, config/site.def: Changing "dpmuser" to "dpmmgr". * Imakefile: The "rpm-oracle" target uses the right $(PACKAGE)-oracle.spec file. * dpm/: dpm-addfs.c, dpm-addpool.c: better error message if component exists already * scripts/lcg-info-dynamic-dpm: A small fix was required. * test/dpm/socketSuite: Changed $baseDpm to "/dpm/cern.ch/home/dteam". * scripts/lcg-info-dynamic-dpm: Script required by the Info system for SE creation. * test/srmv2/srmv2Suite: Small fixes. * ns/Cupv_check.c: Jean-Philippe added support for trusted hosts appearing in /etc/shift.conf * DPM.spec: Improving RPM client files and adding the "Provides: libdpm.so " clause to the client RPM definition. * test/: dpm/stressSuite, srmv2/stressSuite, srmv2/soapcallns1.ic, srmv2/parsesurl.ic, srmv2/Imakefile: Introduce new include files (for ESEC error recovery on client side). Introduce stressSuite(s). * test/: dpm/socketSuite, srmv2/srmv2Suite: Both suites were migrated to "rfio only" transfers. * security/Csec_api.c: Changes for target name and host cert detection * security/Csec_plugin_GSS.c: More specific serrno from missing or expired certifiate * dpm/dpm_proclreq.c: fix error processing when creating directories on disk * DPM.spec: Renaming the RPMs. Changed some rfio man pages. * DPM-oracle.spec: Creating DPM-oracle.spec * DPM.spec: RFIO package called "dpm-rfio-server" instead of "rfio-server". * DPM.spec: Added init.d scripts, logrotate and sysconfig files. Added the RFIO man pages. * test/ns/stat_replicas.c: modifying comment * srmv2/srmv2_dirreq.c: improve logging of Mkdir, Rmdir and Mv methods * dpm/dpm_procreq.c, srmv2/srmv2_xferreq.c: fix processing of StatusOfCopyRequest * dpm/: dpm.scripts.mysql, dpm.scripts.oracle, dpm.sysconfig.mysql, dpm.sysconfig.oracle: The DPM user is now called "dpmmgr" instead of "dpm". The DPm config file is called "DPMCONFIG" instead of "NSCONFIG". * ns/: dpnsdaemon.scripts.mysql, dpnsdaemon.scripts.oracle, dpnsdaemon.sysconfig.mysql, dpnsdaemon.sysconfig.oracle: The DPM user is now called "dpmmgr" instead of "dpm". * test/ns/: query_files.c, query_rate.c, stat_replicas.c: Modfiying comments * test/: srmv1/my_rfcp_in.sh, srmv1/my_rfcp_out.sh, srmv1/srmv1Suite, srmv2/srmv2Suite: Suites improvements. * security/Csec_api_loader.c: Implementing the CSEC_NOTHREAD envvar use. * ns/Cns_statr.man: Instead of sourcing the Cns_statg man page, created a specific one for Cns_statr. It preventd the "make install.man" to complain when installing the Cns_statr man page. * test/ns/delete_files.c: Fixing bug in tidy-up procedure * ns/Imakefile.dpns, ns/Imakefile.lfc, rfio/Imakefile: Using the FILTERMANPAGE macro instead of the CREATEMANPAGE or IMANPAGE ones. * config/Imake.rules: Removed the CREATEMANPAGE macro, created the FILTERMANPAGE one. * scripts/filter-manpage.sh: Simplified the script a bit, and added the filtering for the RFIO man pages. * dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, dpm/dpm.sysconfig.mysql, dpm/dpm.sysconfig.oracle, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/dpnsdaemon.sysconfig.mysql, ns/dpnsdaemon.sysconfig.oracle, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle, ns/lfcdaemon.sysconfig.mysql, ns/lfcdaemon.sysconfig.oracle: Fixing bug #7895 : the LFC, DPNS and DPM daemons will be run as the user specified in the corresponding sysconfig file (and not as root anymore) . Adding the chown "$user:$group /var/log/" step in the init.d scripts as well. * rfio/rfio_callhandlers.c: For stat of managed files, take info from disk except ownership and permissions which are taken from DPNS * rfio/: rfio_calls.c, rfio_call64.c: set correct permissions and ownerships on managed disk files * rfio/rfio_HsmIf.c: convert turl to pfn * rfio/mstat.c: reset serrno when setting rfio_errno (to get a correct error message) * rfio/connect.c: better error message if failure in establishing security context * dpm/dpm_proclreq.c: set the correct permissions and ownerships on the directories automatically created in the DPNS * win32/: Cinitservice.c, cmdf2argv.c, dirent.h, getopt.c, getregkey.c, grp.h, inet_netof.c, install.c, pwd.h, service.c, sleep.c, slogmsg.h, statbits.h, syslog.c, syslog.h, uxid.c, ws_errmsg.c, ws_errmsg.h: Imported from CASTOR * test/ns/delete_files_rate.c: Fix for bug in tidy-up procedure * scripts/choose-module: Added BuildSecureRfio NO and BuildSecureDpm NO if BuildSecurity = YES. * scripts/choose-module: Added BuildRfioClient NO and BuildRfioServer NO. * dpm/dpm.scripts.mysql, dpm/dpm.scripts.oracle, ns/dpnsdaemon.scripts.mysql, ns/dpnsdaemon.scripts.oracle, ns/lfcdaemon.scripts.mysql, ns/lfcdaemon.scripts.oracle: Added "sleep 5" in the restart command (otherwise, the daemon tries to restart to quickly after being stopped, and it fails because it seems to be still running). * DPM.spec: Changed /opt/lcg to be %{prefix} where needed. * LFC-oracle.spec, LFC.spec: Added more parsing of the config/site.def file (BuildRfioClient NO, etc.). * Imakefile: When producing the RPMs on Scientific Linux, the @OS@ in the spec file is automatically replaced by "_sl3". * DPM.spec, LFC.spec: Adding the @OS@ part to be replaced by "_sl3" if thr RPMs are produced on Scientific Linux. * ns/Cupv_check.c: return EACCES instead of EPERM if access to Cupv server is not enabled * dpm/dpm_proclreq.c: create the directories on disk with correct ownership and permissions * dpm/: Imakefile, dpm_main.c: recognize STAGERSUPERUSER * ns/Cns_procreq.c: fix logging of method accessr * rfio/parse.c: suppress "castor" from trace message * rfio/: rfio_call64.c, rfio_calls.c: fix processing of errors returned by rfio_handle_open * rfio/rfio_callhandlers.c: prefix pfn by 'hostname:' before calling Cns_accessr * test/dpm/socketSuite: Improvement to srmv1Suite. * test/ns/: create_files.c, create_files_rate.c, delete_files.c, delete_files_rate.c, nested_symlinks.c, query_files.c, query_rate.c, read_files.c, read_rate.c, rm_replicas.c, stat_replicas.c, symlinks.c: Making code more strictly C-compliant * test/srmv1/: srm_testJiri.c, srmv1Suite: Implemented advisoryDelete in srmv1Suite. * test/dpm/Imakefile: add -lsocket -lnsl for SOLARIS * config/site.def: define OperatorDir for NOMORERFIO * test/srmv2/srmv2Suite: Improved rfcp printout when RFIO_TRACE is set. * srmv1/Imakefile, srmv2/Imakefile: suppress CSECINC (Csec header files are now in the same location as the others) * srmv1/srm_util.c, srmv2/srm_util.c: fix test on error condition * dpm/Imakefile: add -lnsl for SOLARIS * security/Csec_protocol_policy.c: Solaris compiler does not accept arithmetic on void * pointers * rfio/: close.c, fstat.c, mstat.c, open.c, open64.c, read.c, stream64.c: '//' is not a valid comment for a standard C compiler * h/rfcntl.h: fix comment * ns/Imakefile: suppress extraneous endif * ns/Imakefile, rfio/switch_req.c: add support for Darwin * rfio/rfstatfs.c: more modifications for Darwin * test/srmv2/srmv2Suite: Improve the internal PTH for client commands. * config/site.def: KRB5 is not built by default anymore. * socket/dpmcli/module.mk, test/srmv1/srmv1Suite, test/srmv2/srm2_testExtendFileLifeTime.c, test/srmv2/srm2_testPut.c, test/srmv2/srm2_testSetPermission.c, test/srmv2/srmv2Suite: Last updates after March '05. * test/ns/: create_files.c, create_files_rate.c, delete_files.c, delete_files_rate.c, nested_symlinks.c, query_files.c, query_rate.c, read_files.c, read_rate.c, rm_replicas.c, stat_replicas.c, symlinks.c: changing from lfc to Cns api * h/: osdep.h, rfcntl.h, rfio_api.h: add support for Darwin * scripts/RLS-migration/RLS-migration.tar.gz: Adding the RLS-migration tarball to the repository. * scripts/RLS-migration/README: The path should be of the form "/grid/atlas" instead of "/grid/atlas/". * scripts/RLS-migration/: bin/Makefile, bin/migrate_files.c, lib/QueryAndUpdate.pm: Modified a bit before creating the RLS-migration tarball. * scripts/RLS-migration/lib/QueryAndUpdate.pm: Fixin typo where "); was missing. * test/ns/Imakefile: do not depend on shift library * test/dpm/Imakefile: do not depend on shift library * Imakefile: add SECURITYDIR * security/Csec_api_loader.c: suppress soname * security/Imakefile: Initial release * common/Cgrp.c, common/Cinitdaemon.c, common/Cpwd.c, common/isTrustedHost.c, common/log.c, common/serror.c, rfio/feof.c, rfio/ferror.c, rfio/fread.c, rfio/fseek.c, rfio/fseeko64.c, rfio/fwrite.c, rfio/getc.c, rfio/popen.c, rfio/rfstatfs.c, security/Csec_protocol_policy.c: port to Darwin * lib/Imakefile: add rule to create the dependency library security/libsecurity.a * ns/: Imakefile.cns, Imakefile.dpns, Imakefile.lfc: isTrustedHost is now part of the "common" library * dpm/dpm_getturl.c: add r_token to the list of arguments * h/dpm_api.h: add prototype for function dpm_getturl * h/rfio_api.h: change rfio_HsmIf_getipath and rfio_HsmIf_reqtoput function prototypes to support DPM * rfio/: close.c, fclose.c, rfio_HsmIf.c, rfio_call64.c, rfio_calls.c, stream.c, stream64.c: add interface to DPM * rfio/Imakefile: add rule for rfio_callhandlers * dpm/Imakefile: add rule for dpm_getturl * dpm/dpm_getturl.c, rfio/rfio_callhandlers.c: Initial release * dpm/: dpm.sysconfig.mysql, dpm.sysconfig.oracle: Added the possibility to have another GRIDMAPDIR than /etc/grid-security/gridmapdir. * dpm/dpm.scripts: Removing the unique init.d script, as there are now two (one for Oracle and one for MySQL). * dpm/: dpm.scripts.mysql, dpm.scripts.oracle: Adding two DPM init.d scripts : one for Oracle and one for MySQL. * dpm/: dpm.scripts, dpm.sysconfig.mysql, dpm.sysconfig.oracle: Adding the init.d script, and the sysconfig files for Oracle and MySQL. * ns/: dpnsdaemon.sysconfig.oracle, lfcdaemon.sysconfig.oracle: Removed the "NOT RECOMMENDED !!" part if Oracle and the LFC are installed on the same machine. * h/serrno.man: document DPM and Security error codes * common/serror.c: add messages for "security" and "dpm" packages * h/serrno.h: add ETBADMIR * srmv1/Imakefile, srmv2/Imakefile: suppress dependency on "shift" library and Csec module * shlib/Imakefile: add RFIOLIB and SECURITYLIB * ns/Imakefile: use TOPLIBRARYNAME instead of "shift" * lib/Imakefile: add RFIOLIB and SECURITYLIB * h/serrno.h: add 2 error codes for Csec * h/: Csemaphore.h, rfio.h, rfio_api.h, rfio_constants.h, rfio_errno.h, rfio_rdirfdt.h, rfio_rfilefdt.h: imported from CASTOR * dpm/Imakefile: do not depend on shift library * common/Imakefile: suppress support for Adns * config/site.def: define TopLibraryName; add defines for rfio and security directories * config/: Imake.rules, Win32.rules: define DepSharedLibraryTargetName macro * config/: Library.tmpl, Project.tmpl: add "security" directory * rfio/rfio_call64.c: add security * rfio/rfio_call64.c: imported from CASTOR * rfio/rfio_calls.c: add security; suppress chk_newacct * rfio/rfio_calls.c: imported from CASTOR * rfio/rfio_serv.c: add security * rfio/rfio_serv.c: imported from CASTOR * rfio/rfio_HsmIf.c: include ; make calls to old stager conditional * doc/lfc/: INSTALL-server-mysql, INSTALL-server-oracle: lfc-setacl line modified with "d:o::7" * rfio/rfio_HsmIf.c: imported from CASTOR * rfio/rfcp.c: make calls to old stager conditional * rfio/rfcp.c: imported from CASTOR * rfio/parse.c: include * rfio/parse.c: imported from CASTOR * rfio/Imakefile: use TopLibraryName instead of "shift"; add security * rfio/Imakefile: imported from CASTOR * rfio/connect.c: add security * rfio/connect.c: imported from CASTOR * rfio/: Csemaphore.c, README.Win32, access.c, alrm.c, chdir.c, checkkey.c, chkserv.c, chmod.c, chown.c, close.c, closedir.c, dump_log.c, error.c, fchmod.c, fchown.c, fclose.c, feof.c, ferror.c, fflush.c, fileno.c, fio.c, fopen.c, fopen64.c, fortran.F, fread.c, fseek.c, fseeko64.c, fstat.c, fstat64.c, ftell.c, ftello64.c, fwrite.c, getc.c, getcwd.c, lockf.c, lockf64.c, logging.c, logging.h, lseek.c, lseek64.c, lstat.c, lun2fn.c, misc.c, mkdir.c, mstat.c, msymlink.c, munlink.c, open.c, open64.c, opendir.c, pclose.c, popen.c, pread.c, preseek.c, preseek64.c, pwrite.c, read.c, read64.c, readdir.c, readlink.c, rename.c, rewinddir.c, rfcat.c, rfcat.man, rfchmod.c, rfchmod.man, rfcp.man, rfdir.c, rfdir.man, rfio_access.man, rfio_chmod.man, rfio_chown.man, rfio_close.man, rfio_closedir.man, rfio_fcalls.c, rfio_fchmod.man, rfio_fclose.man, rfio_feof.man, rfio_ferror.man, rfio_fflush.man, rfio_fileno.man, rfio_fopen.man, rfio_fopen64.man, rfio_fread.man, rfio_fseek.man, rfio_fseeko64.man, rfio_fstat.man, rfio_fstat64.man, rfio_ftell.man, rfio_ftello64.man, rfio_fwrite.man, rfio_lockf.man, rfio_lockf64.man, rfio_lseek.man, rfio_lseek64.man, rfio_lstat.man, rfio_lstat64.man, rfio_mkdir.man, rfio_mstat.man, rfio_mstat64.man, rfio_msymlink.man, rfio_munlink.man, rfio_open.man, rfio_open64.man, rfio_opendir.man, rfio_pclose.man, rfio_perror.man, rfio_popen.man, rfio_preseek.man, rfio_preseek64.man, rfio_rdirfdt.c, rfio_read.man, rfio_readdir.man, rfio_readlink.man, rfio_rename.man, rfio_rewinddir.man, rfio_rfilefdt.c, rfio_rmdir.man, rfio_serrno.man, rfio_serror.man, rfio_stat.man, rfio_stat64.man, rfio_statfs.man, rfio_symlink.man, rfio_unlink.man, rfio_write.man, rfioacct.c, rfiod.logrotate, rfiod.man, rfiod.scripts, rfiod.sysconfig, rfioreadopt.man, rfiosetopt.man, rfmkdir.c, rfmkdir.man, rfrename.c, rfrename.man, rfrm.c, rfrm.man, rfstat.c, rfstatfs.c, rmdir.c, setopt.c, stat.c, statfs.c, stream.c, stream64.c, switch_req.c, symlink.c, unlink.c, write.c, write64.c, xyclose.c, xyopen.c, xyread.c, xywrite.c: imported from CASTOR * doc/lfc/INSTALL-server-oracle: Upgraded the version of the oracle-instantclient RPM to install. * LFC-oracle.spec: Added line to prevent the warnings from creating the LFC Oracle server RPM on Scientific Linux 3. * ns/Cns_oracle_tbl.sql.templ: Creating a schema template, so that the indexes use the user tablespace. * security/: Csec_api.c, Csec_api_loader.c, Csec_apiinit.c, Csec_api.man, Csec_common.c, Csec_errmsg.c, Csec_plugin_GSS.c, Csec_plugin_GSS_mapper.c, Csec_plugin_ID.c, Csec_plugin_KRB4.c, Csec_protocol_policy.c, Csec_static_loader.c, security.sysconfig: Imported from CSEC module * doc/lfc/: INSTALL-server-mysql, INSTALL-server-oracle: Putting version back to 1.1.1 in the information provider part. * doc/lfc/: INSTALL-server-mysql, INSTALL-server-oracle: Modified the info provider part. Csec_plugin.h, Csec_protocol_policy.h: From CSEC module * ns/Cupv_check.c: define dummy Cupv_seterrbuf routine (we are not using the Cupv server) * ns/nsshutdown.c: include "Cns_api.h" * scripts/README, LFC-oracle.spec: Renamed create-schema to be create-schema-lfc. * scripts/create-schema: Renaming it create-schema-lfc. * scripts/create-schema-lfc: Renaming create-schema to create-schema-lfc * LFC-oracle.spec: Added the README file, create-tablespaces, create-user and create-schema scripts in a proper location. * scripts/: README, create-schema: Added the possibility to give another location for the DB schema than the one by default. * doc/lfc/INSTALL-server-mysql: Modified the LFC user creation to be more secure. * h/sacct.h: old stager accounting is now conditional * Imakefile: add "rfio" sub-directory * scripts/create-schemas: Renaming this file to "create-schema". * scripts/create-schema: Renaming the create-schemas script. * scripts/create-schemas: First version of the create-schemas script. * scripts/RLS-migration/README: Perl has to be installed for the migration script to work. * scripts/RLS-migration/lib/Common.pm: Fixed error for Oracle case. * scripts/RLS-migration/README: $ORACLE_HOME has to be set, if the RLS database is on Oracle. * scripts/RLS-migration/README: Added that the LFC_HOST should be set on the machine where the migration script is run. * scripts/RLS-migration/README: Updated the README file after changing the migration script to support the migration from an RLS MySQL server as well. * scripts/RLS-migration/: bin/Makefile, bin/migrate_RLS_entries, bin/migrate_files.c, lib/Common.pm: Modified files to support the migration from an RLS MySQL server. * scripts/RLS-migration/: bin/migrate_RLS_entries, lib/QueryAndUpdate.pm: Removed the vo argument (only the path one is taken into account now). * scripts/RLS-migration/lib/Common.pm: Removed the Oracle environment checking part to put it in the migrate_RLS_entries script. * scripts/RLS-migration/bin/migrate_RLS_entries: Added changes to support the migration from a MySQL RLS server. * lib/Imakefile, shlib/Imakefile: add librfio to libdpm * scripts/RLS-migration/bin/Makefile: Added "-lCsec -ldl" and put "../../../" where needed. * scripts/RLS-migration/bin/migrate_files.c: adding new arguments to add_replicas * srmv2/srmv2_xferreq.c: include "dpns_api.h" * lib/Imakefile: add libcommon to libdpm * h/: Cmutex.h, Cregexp_magic.h, Csched_api.h, Csched_flags.h, Cthread_typedef.h, Cuuid.h, log.h, sacct.h, trace.h: header files included by "common" files must be added * dpm/Imakefile: isTrustedHost is now part of the "common" library * Imakefile, lib/Imakefile, shlib/Imakefile: add "common" sub-directory * common/: Cdomainname.c, Cgetopt.c, Cgetopt.man, Cglobals.c, Cglobals.man, Cgrp.c, Cgrp.man, Cinitdaemon.c, Cmutex.c, Cmutex.man, Cnetdb.c, Cpool.c, Cpool.man, Cpwd.c, Cpwd.man, Cregexp.c, Csched.c, Csched.man, Csnprintf.c, Cthread.c, Cthread.man, Cuuid.c, Cuuid.man, Imakefile, getconfent.c, getconfent.man, getfilep.c, getifnam.c, getuser.c, log.c, log.man, marshall.c, netclose.man, netread.man, netwrite.man, remote.c, sacct.logrotate, serror.c, setnetio.c, socket.c, socket_timeout.c, solveln.c, trace.c, u64subr.c, wsacct.c: Imported from CASTOR 2005-03-28 00:06 slemaitr Before tagging 1.2.6 : * dpm/Imakefile, ns/Imakefile, srmv1/Imakefile, srmv2/Imakefile: Added -I/usr/local/include/Csec if BuildSecurity is set to YES. * ns/Cns_mysql_tbl.sql: Added IF EXISTS when dropping the schema_version table. * ns/: dpnsdaemon.sysconfig.mysql, dpnsdaemon.sysconfig.oracle: Adding the DPNS daemon sysconfig files. * ns/: dpnsdaemon.scripts.mysql, dpnsdaemon.scripts.oracle: Added the GRIDMAPDIR variable definition. * scripts/RLS-migration/: bin/migrate_RLS_entries, lib/QueryAndUpdate.pm: Added the possibility for the user to specify its own directory where to migrate the entries, with the --path option. * shlib/Imakefile: Added -lCsec as published shared library if BuildSecurity is set to YES. * ns/: lfcdaemon.scripts.mysql, lfcdaemon.scripts.oracle, lfcdaemon.sysconfig.mysql, lfcdaemon.sysconfig.oracle: Added the GRIDMAPDIR variable in the init.d scripts and the sysconfig LFC files. * scripts/RLS-migration/README: Adding a README file explaining how to use the RLS to LFC migration script. * scripts/RLS-migration/bin/: Makefile, migrate_RLS_entries, migrate_files.c, migrate_path.c: Adding useful files for the RLS to LFC migration. * scripts/RLS-migration/lib/: Common.pm, QueryAndUpdate.pm: Adding useful packages for the RLS to LFC migration. * scripts/filter-manpage.sh: "/opt/lcg/etc/NSCONFIG" appears in the LFC and DPNS daemon man pages, instead of "/etc/NSCONFIG". * ns/: dpnsdaemon.scripts.mysql, dpnsdaemon.scripts.oracle: Adding the DPNS init.d scripts for Oracle and MySQL. * ns/: lfcdaemon.scripts.mysql, lfcdaemon.scripts.oracle: Creating two separate init.d scripts for Oracle and MySQL. * ns/lfcdaemon.scripts: Replacing lfcdaemon.scripts by lfcdaemon.scripts.mysql and lfcdaemon.scripts.oracle. * LFC-oracle.spec, LFC.spec: Using lfcdaemon.scripts.oracle or lfcdaemon.scripts.mysql depending on the DB vendor. * ns/lfcdaemon.scripts: $LD_LIBRARY_PATH doesn't overwrite the existing environment variable. * LFC.spec, LFC-oracle.spec, DPM.spec: The release number is now "1@SECURITY@" instead of "1", so that the RPM is automatically called properly, depending if BuildSecurity is set to YES or NO. * Imakefile: The RPMs will now have a release number be set to "1" or "1sec" automatically, depending if BuildSecurity is NO or YES. * srmv1/srmv1_procreq.c: enable full processing of advisoryDelete * test/ns/Imakefile: updating makefile * dpm/dpm_proclreq.c: For an SRM v1 put request, try to create the missing directories on the fly * ns/Cns_procreq.c: make sure that server and sfn are both specified for addreplica * test/ns/: create_files.c, create_files_rate.c, delete_files.c, delete_files_rate.c, nested_symlinks.c, query_files.c, query_rate.c, read_files.c, read_rate.c, rm_replicas.c, stat_replicas.c, symlinks.c, delete_rate.pl, delete_times.pl, delete_times_inc_files.pl, insert_rate.pl, insert_times.pl, insert_times_inc_files.pl, nested_symlinks.pl, query_files.pl, query_rate.pl, read_files.pl, stat_replicas.pl, symlinks.pl, README: Moving tests to correct directory.. * doc/lfc/: INSTALL-server-mysql, INSTALL-server-oracle: Updated the sysconfig part. * LFC-oracle.spec, LFC.spec: The RPM will distribute either lfcdaemon.sysconfig.mysql or lfcdaemon.sysconfig.oracle depending on the DB vendor. * ns/lfcdaemon.sysconfig: Removing this file after having created two sysconfig files : one for Oracle and one for MySQL. * ns/: lfcdaemon.sysconfig.mysql, lfcdaemon.sysconfig.oracle: Splitting the lfcdaemon.sysconfig file into two : one for Oracle and one for MySQL. * Imakefile: "make rpm-oracle" now uses the correct LFC-oracle.spec file. * DPM.spec, LFC-oracle.spec, LFC.spec: The version is now written automatically when doing a "make rpm" or "make rpm-oracle". * Imakefile: The version is now automatically taken from $VERSION and written in the spec files. * scripts/choose-module: Added the possibility to choose "secure" or "insecure". * ns/Cns_listreplicax.c: fix check on filesystem name length * h/dpm_server.h: define prototype for functions dpm_get_gfr_by_pfn and dpm_get_pfr_by_pfn define structure gc_ident * DPM.spec, LFC-oracle.spec, LFC.spec, VERSION: version 1.2.5 * dpm/: dpm_main.c, poolmgr.c: add Garbage Collector * dpm/dpm_procreq.c: fix pin time processing in putdone, extendfilelife and relfiles * dpm/dpm_proclreq.c: fix pin time processing in dpm_srv_proc_get * dpm/: dpm_mysql_ifce.c, dpm_oracle_ifce.pc: add functions dpm_get_gfr_by_pfn and dpm_get_pfr_by_pfn * dpm/: dpm-modifyfs.c, dpm-rmfs.c: better error message if filesystem does not exist * dpm/: dpm-modifypool.c, dpm-rmpool.c: better error message if pool does not exist 2005-03-11 12:07 slemaitr Before tagging 1.2.4 : * dpm/dpm_procsubr.c: correctly take into account the put requests lifetimes * dpm/dpm_procreq.c: fix log message in modify pool if defsize is not modified * ns/: Cns_listrep4gc.c, Cns_listreplicax.c: fix lp pointer in buffer * LFC-oracle.spec: The README and INSTALL-client files are not copied anymore. * ns/Cns_main.c: add missing case for CNS_LISTREP4GC and CNS_LISTREPLICAX in the main switch * oracle-instantclient/make-oracle-rpm: rpm or rpmbuild command now used to create the Oracle Instant Client RPM for LCG. * oracle-instantclient/: make-oracle-rpm, oracle-instantclient-basic-lcg.spec: Adding spec file and script to produce the oracle-instantclient-basic-lcg RPM. * dpm/oralink.mk, ns/oralink.mk, srmv1/oralink.mk, srmv2/oralink.mk: To avoid link problems on SLC3 with Oracle, simplify oralink.mk for the 4 servers. 2005-03-08 10:42 slemaitr Before tagging 1.2.3 : * LFC.spec: Distributing man page for lfc-delcomment instead of lfc-getcomment... * ns/Imakefile.lfc: Added lfc-delcomment and lfc-setcomment where missing. * ns/Imakefile.dpns: Removing dpns_getcomment from the man pages being installed. * ns/Imakefile.lfc: Adding the following binaries/man pages to be installed : lfc-delcomment, lfc-setcomment, lfc_delcomment, lfc_getcomment, lfc_setcomment, lfc_readdirc, lfc_readdirxc. * LFC.spec: Adding the following binaries/man pages : lfc-delcomment, lfc-setcomment, lfc_delcomment, lfc_getcomment, lfc_setcomment, lfc_readdirc. lfc_readdirxc. * DPM.spec: Removing dpns_getcomment from the distributed man pages. * dpm/dpmlogit.c, ns/nslogit.c, srmv1/srmlogit.c, srmv2/srmlogit.c: Protect against very long messages overflowing the log buffer * ns/Cns_mysql_ifce.c: protect Cns_update_rep_entry against null f_type * ns/Cns_mysql_ifce.c: avoid crash in decode_rep_entry: f_type column is NULL for LFC 2005-03-04 11:53 baud Before tagging 1.2.2 : * ns/: Imakefile.dpns, Imakefile.lfc: add Cupv_check * h/Cupv.h, ns/Cupv_check.c: Imported from CASTOR 2005-03-03 11:45 slemaitr Before tagging 1.2.1: * LFC-oracle.spec: The new spec file doesn't build the NameServerClient anymore. * LFC-oracle.spec: Added %{prefix} in the "make install" and "make install.man" steps. * LFC-oracle.spec: The previous spec file was not building the NameServerDaemon. This one does. * scripts/filter-manpage.sh: In the dpns-getacl and dpns-setacl man pages, "/dpm/dteam/test/..." appears instead of "/dpm/test/..." now. * dpm/dpm_main.c, ns/Cns_main.c: return an error if "ID" protocol or a host certificate is used and the client machine is not trusted map to uid=0/gid=0 if "ID" protocol or host certificate but no AuthorizationId * common/isTrustedHost.c: add localhost to argument list to be able to trust localhost * srmv1/srmv1_procreq.c, srmv2/srmv2_dirreq.c, srmv2/srmv2_permreq.c, srmv2/srmv2_xferreq.c: add calls to xxx_seterrbuf to avoid sending messages to stderr * LFC-oracle.spec: Put instead of /opt/lcg for the NSCONFIG.templ file. Added the DB deployment scripts, but as comments. * LFC.spec: Put instead of /opt/lcg for the NSCONFIG.templ file. * DPM.spec: - dpns-shutdown and dpm-shutdown are now distributed with the DPNS and DPM server RPMs. - added the daemon and shutdown man pages where needed - changed the messages : instead of /opt/lcg * scripts/filter-manpage.sh: Changes in the man pages parsing : - LCG Grid Deployment Team now displayed in the AUTHOR section - no more reference to getsegattrs - references to Cupvlist put back - lfc_DIR and dpns_DIR appears instead of Cns_DIR - /dpm instead of /grid/... for the DPNS * ns/Imakefile.dpns: The lfc_getcomment and lfc_stat man pages are not installed anymore. * dpm/Imakefile: Moved dpm-shutdown to the server (was in the client). Separated client and server man pages. * dpm/Imakefile: add more man pages * DPM.spec: add man pages * Imakefile: Added "scripts" to the sources, so that the filter-manpage.sh script is found when doing "make rpm". * DPM.spec: Added %{prefix} in the following lines : make prefix=${RPM_BUILD_ROOT}%{prefix} install # make prefix=${RPM_BUILD_ROOT}%{prefix} install.man * LFC.spec: Added %{prefix} in the following lines : make prefix=${RPM_BUILD_ROOT}%{prefix} install make prefix=${RPM_BUILD_ROOT}%{prefix} install.man * Imakefile: Added the "common" directory in the sources. * config/site.def: define BuildSecurity 2005-02-28 14:48 slemaitr Before tagging 1.2.0: * config/site.def: Added "/opt/lcg" as prefix by default. Replaced "$(prefix)/opt/lcg" by "$(prefix)" everywhere, so that the modules are installed in the $(prefix) specified by the user. * test/: dpm/socketSuite, srmv1/srm_testJiri.c: More fixes for the socketSuite * dpm/poolmgr.c: fix dpm_getpoolconf when recovering several filesystems in a pool * srmv1/srmv1_procreq.c: better error message if token not found * dpm/: dpm_mysql_tbl.sql, dpm_oracle_tbl.sql: change definition of r_token from CHAR to VARCHAR because srmv1 tokens are shorter * socket/dpmcli/dpmestat.h, socket/dpmcli/module.mk, test/srmv1/srm_testJiri.c, test/srmv2/srm2_testPut.c, test/srmv2/srmv2Suite: Various fixes. * dpm/dpm_main.c: add message: "removing expired put file" in rexthread * srmv2/srmv2_xferreq.c: fix security for ReleaseFiles method (which does a Cns_setptime) * test/: dpm/Imakefile, ns/Imakefile: add security * srmv1/: Imakefile, srmv1_procreq.c: add security * srmv2/: Imakefile, srmv2_dirreq.c, srmv2_permreq.c, srmv2_xferreq.c: add security * h/: Cns.h, Cns_api.h, Cns_server.h, dpm.h, dpm_api.h, dpm_server.h, Castor_limits.h, serrno.h: add security * dpm/: Imakefile, dpm_main.c, dpm_proclreq.c, dpm_procreq.c, send2dpm.c: add security * dpm/dpm_auth.c: Initial release * ns/: Cns_main.c, Cns_procreq.c, send2nsd.c, Imakefile, Imakefile.cns, Imakefile.dpns, Imakefile.lfc: add security * ns/Cns_auth.c: Initial release * ns/Imakefile: suppress explicit reference to /usr/local/lib for libshift * doc/lfc/: INSTALL-client, INSTALL-server-mysql, INSTALL-server-oracle: Updated documentation to make it clearer and according to recent changes. * dpm/dpm_procreq.c: - increment reqctr for each request recovered at startup time - initialize statbuf in rm_onereplica to not change free space if file does not exist - do not return error in rm_onereplica if replica entry does not exist in DPNS * dpm/dpm_main.c: move the reqctr mutex initialization before the recover_queue because the latter might increment reqctr * DPM.spec: Version = 1.1.3 now. * ns/: Imakefile.cns, Imakefile.dpns, Imakefile.lfc: Removed the MakeDir for $(BIN), $(SPOOL) and $(SACCTDIR) to put it in the generic ns/Imakefile. Remove the ## CLEANING RULES ## and ## DEPENDENCIES ## parts. * ns/Imakefile: Added MakeDir for $(BIN), $(SPOOL) and $(SACCTDIR). Removed it from the lfc, cns, dpns specific Imakefiles. Removed the #if for the MakeDir of $(MANDIR) and $(LIBMANDIR). * scripts/choose-module: Adding a script that modifies the config/site.def file according to the module you want to build. * LFC-oracle.spec, LFC.spec: Only one tabulation for BuildNameServerAsLFC and BuildNameServerAsDPNS. * LFC-oracle.spec, LFC.spec: The config/site.def file is now parsed correctly : BuildNameServerAsDPNS NO, instead of YES. * scripts/filter-manpage.sh: Added some more parsing of the man pages : nsshhutdown becomes lfc-shutdown or dpns-shutdown, "castor5.cern.ch" becomes "lxb1925.cern.ch", and "/castor" becomes "/grid". * srmv1/srmv1_procreq.c: handle DPM_RELEASED * srmv2/srmv2_xferreq.c: handle DPM_RELEASED * dpm/dpm_procsubr.c: set file status to DPM_RELEASED after a successful dpm_relfile * h/dpm_constants.h: define DPM_RELEASED * ns/Imakefile.cns: Separated the client man pages and the server ones. * ns/Imakefile.lfc: Added $(LIBMANDIR) in the install.man target for the Client. * ns/Imakefile.lfc: Removed $(MANPAGES) from the all target. Grouped the LFCMANPAGE and IMANPAGE in a single CREATEMANPAGE macro. * ns/Imakefile.dpns: Added DPNS man pages created by parsing the Cns_ and ns ones. * ns/Imakefile: $(MANDIR) and $(LIBMANDIR) are now created in the main ns/Imakefile, and not in each Imakefile.lfc, Imakefile.dpns, Imakefile.cns. * scripts/filter-manpage.sh: Added some more parsing cases for the DPNS. * config/Imake.rules: Renamed the LFCMANPAGE to CREATEMANPAGE, as it is used now for both DPNS and LFC. The CREATEMANPAGE macro calls the IMANPAGE one as well now. * scripts/filter-manpage.sh: Added the filtering to create the DPNS man pages. * ns/Imakefile.lfc: Removing lfc-chmod from the LFC server man pages. * LFC-oracle.spec: Uncommented the man pages. Parsing the config/site.def file to build the module as LFC. 2005-02-15 12:12 slemaitr Before tagging 1.1.3 : * ns/Imakefile.lfc: Separated the man pages created for the LFC server and the LFC client modules. * shlib/Imakefile: support for darwin * config/Imake.rules: Added the LFCMANPAGE macro that parses a Cns_command.man/nscommand.man file and creates the corresponding lfc_command.man/lfc-command.man file. * ns/Imakefile: Splitted the Imakefile into three (CNS, LFC and DPNS). This Imakefile is the primary one that refers to Imakefile.cns, Imakefile.lfc or Imakefile.dpns depending on the configuration given in the config/site.def file. * ns/: Imakefile.cns, Imakefile.dpns, Imakefile.lfc: Spliting the Imakefile into three different ones : CNS, LFC and DPNS. * socket/dpmcli/dpm-getreqid.c, srmv2/oralink.mk, test/dpm/socketSuite, test/srmv2/srm2_testLs.c, test/srmv2/srmv2Suite: Last commit prior to security tests. Includes the srmv2/oralink.mk simplified module. * scripts/: migrate-mysql-schema-to-1-1-1.sql, migrate-oracle-schema-to-1-1-1.sql: Added the index on Cns_file_metadata(PARENT_FILEID). Added the schema_version table. * ns/: Cns_mysql_tbl.sql, Cns_oracle_tbl.sql: Adding an index on Cns_file_metadata(PARENT_FILEID). Adding the schema_version table. * imake/: imake.c, imakemdep.h: add support for darwin * config/: darwin.cf, darwin.rules: Initial release * config/Imake.tmpl: add support for darwin * dpm/: dpm_main.c, dpm_oracle_ifce.pc, dpm_proclreq.c: - do not share Oracle contexts between fast and slow threads - have rexthread use its own sql context (to avoid CONNECT error: SQL-02134) * srmv2/srmv2_dirreq.c: More informative global statusCode for srmLs * srmv2/srmv2_dirreq.c: fix another crash in the srmLs processing * srmv2/srmv2_dirreq.c: fix group and user permissions * scripts/change-man-pages-for-lfc.sh: Renamed "filter-manpage.sh" * scripts/filter-manpage.sh: Changing name from change-man-pages-for-lfc.sh to filter-manpage.sh. Also added a check for the ENSNACT error. * scripts/change-man-pages-for-lfc.sh: nroff on lfc-* and lfc_* commands. Also, replace the references to lfc_stat to lfc_statg, lfc_mkdir to lfc_mkdirg, etc. * doc/lfc/: INSTALL-server-mysql, INSTALL-server-oracle: Added the following step during initial directories creation, to avoid permission problems : > lfc-setacl -m d:u::7,d:g::7,d:o:7 /grid/dteam * srmv1/Imakefile: add DEPLIB for srmv1 server with Oracle backend * srmv2/Imakefile: add DEPLIB for the srmv2 with Oracle backend * srmv2/srmv2_dirreq.c: add listing of directories * ns/lfcdaemon.scripts: Added the possibility to specify another location than the one by default for the log and configuration files. * dpm/dpm_main.c: initialize dbfd in rexthread * doc/lfc/: INSTALL-server-mysql, INSTALL-server-oracle: Changed documentation to integrate the /etc/init.d/lfcdaemon script, as well as the logrotate one. * LFC-oracle.spec: Changed the message displayed after the LFC Oracle server RPM installation (using /etc/init.d/lfcdaemon instead of /opt/lcg/bin/lfcdaemon). * LFC.spec: Changing the message displayed after the LFC MySQL server RPM installation (using /etc/init.d/lfcdaemon instead of /opt/lcg/bin/lfcdaemon). * srmv1/srmv1_procreq.c: add processing of DPM_EXPIRED set isPermanent in FileMetaData when necessary * ns/lfcdaemon.sysconfig: Added the possibility to set different values than the ones by default for : log file, NSCONFIG and TWO_TASK. * srmv2/srmv2_xferreq.c: handle DPM_EXPIRED * h/dpm_constants.h: define DPM_EXPIRED * dpm/dpm_main.c: set dpm_put_filereq entry status to DPM_EXPIRED after the put timeout has expired * dpm/dpm_main.c: fix rexthread to avoid tight loop 2005-02-03 13:35 slemaitr Before tagging 1.1.2 : * ns/Cns_procreq.c: fix listreplica method (to have backward compatibility with 1.0.3 client) * ns/Cns_mysql_ifce.c: fix compilation error * ns/Cns_mysql_ifce.c: fix Cns_decode_rep_entry (fs missing) fix Cns_insert_rep_entry for Null value in f_type * ns/Cns_procreq.c: fix backward compatibility problem in addreplica 2005-02-02 19:21 slemaitr Before tagging 1.1.1 : * LFC.spec: Because liblfc.so isn't "provided" by the LFC-client RPM on SL3, adding : Provides: liblfc.so * test/: CounterFile, dpm/socketSuite, srmv2/srmv2Suite: Last updates before rebuilding the whole stuff. Only 2 Suites (socket and srmv2) modified. * scripts/: migrate-mysql-schema-to-1-1-1.sql, migrate-oracle-schema-to-1-1-1.sql: Script migrating to schema version 1.1.1 : - adding status, poolname, f_type, fs fields - creating the schema_version table with values (1,1,1) * ns/Imakefile: Put the lfc-shutdown and dpns-shutdown binaries in the clients rather than in the servers (except for Castor). * ns/dpnsdaemon.logrotate, dpm/dpm.logrotate: Initial release * ns/Cns_delreplica.man: guid and fileid are now optional * h/: dpns_api.h, lfc_api.h: add a few missing defines * h/Cns.h: define CNS_LISTREP4GC and CNS_LISTREPLICAX * ns/: Cns_procreq.c, Cns_stat.c: add csumtype and csumvalue for statr method * dpm/dpm_proclreq.c: add f_type and fs to replica definition * ns/Imakefile: add rules for Cns_listrep4gc.o and Cns_listreplicax.o * ns/Cns_procreq.c: add f_type and fs to replica definition make guid and fileid optional in delreplica add methods listrep4gc() and listreplicax() * ns/: Cns_mysql_ifce.c, Cns_oracle_ifce.pc: add f_type and fs to replica definition add methods Cns_list_rep4admin() and Cns_list_rep4gc() * ns/Cns_main.c: add methods listrep4gc and listreplicax * ns/Cns_delreplica.c: make guid and fileid optional * h/Cns_server.h: add f_type and fs to replica definition add function prototype for Cns_list_rep4admin() and Cns_list_rep4gc() * h/Cns_api.h: add f_type and fs to replica definition change Cns_addreplica prototype accordingly add function prototype for Cns_listrep4gc() and Cns_listreplicax() * ns/: Cns_addreplica.c, Cns_listreplica.c, Cns_mysql_tbl.sql, Cns_oracle_tbl.sql: add f_type and fs to replica definition * ns/: Cns_listrep4gc.c, Cns_listreplicax.c: Initial release * ns/: lfcdaemon.logrotate, lfcdaemon.scripts, lfcdaemon.sysconfig: Modified the NS init.d script, sysconfig file and logrotate to be used by the LFC. * dpm/dpm_oracle_ifce.pc: add indicator variables for u_token, errstring, s_token, server and pfn add column "sr_expiretime" to table dpm_put_filereq add function dpm_list_expired_puts fix function dpm_get_next_req (to avoid error ORA-02014) * dpm/dpm_main.c: add thread to remove expired puts * dpm/dpm_mysql_ifce.c: add column "sr_expiretime" to table dpm_put_filereq add function dpm_list_expired_puts * dpm/poolmgr.c: let dpm_selectfs return the default put retention period * dpm/dpm_proclreq.c: set sr_expiretime value * dpm/: dpm_mysql_tbl.sql, dpm_oracle_tbl.sql: add column "sr_expiretime to table dpm_put_filereq * h/dpm_server.h: add member "sr_expiretime" to dpm_put_filereq structure add proto for dpm_list_expired_puts function * ns/: nsgetacl.c, nsls.c: allow for 8 characters group names (instead of 6) * dpm/dpm_proclreq.c: uses rfio_serrno() instead of rfio_errno to handle correctly local/network errors * dpm/poolmgr.c: initialize "elemp" in function dpm_findfs * scripts/: README, create-tablespaces-lfc, create-user-lfc: Adding the scripts (and README file) creating the tablespaces and the users for the LFC. * dpm/dpm_oracle_tbl.sql: add missing columns r_uid and r_gid in table dpm_pending_req * test/dpm/socketSuite: Upgrade LCG-DM/test/dpm/socketSuite to allow for running either rfio or gsiftp for the very first file of the stack (dpm-put operations). * socket/: dpmcli/dpm-getreqid.c, dpmcli/module.mk, goputils/gop_comm.h, goputils/gop_escp.c, goputils/gop_escp.h, goputils/gop_glob.c, goputils/gop_outp.c, goputils/gop_readf.h: New batch of fixes. * dpm/: dpm_abortreq.c, dpm_copy.c, dpm_extendfilelife.c, dpm_get.c, dpm_getprotocols.c, dpm_getreqid.c, dpm_getreqsummary.c, dpm_getstatus_copyreq.c, dpm_getstatus_getreq.c, dpm_getstatus_putreq.c, dpm_inc_reqctr.c, dpm_put.c, dpm_putdone.c, dpm_relfiles.c, dpm_rm.c: include to get htonl ... definition * test/: CounterFile, dpm/socketSuite, srmv1/my_gsiftp_in.sh, srmv1/my_gsiftp_out.sh, srmv1/my_rfcp_in.sh, srmv1/my_rfcp_out.sh, srmv1/srmv1Suite, srmv2/srmv2Suite: Fixed some issues with the 3 suites. They are all tested now, on both platforms, and with remote targets as well. * socket/dpmcli/dpm-getreqid.c, socket/goputils/gop_outp.c, socket/goputils/gop_readf.h, test/CounterFile, test/dpm/socketSuite, test/srmv2/srmv2Suite: Fix in dpm-getreqid + other utils. * test/: CounterFile, dpm/socketSuite, srmv2/srmv2Suite: Updated socketSuite to the same level as srmv2Suite. * test/.cvsignore: To avoid committing CounterFile ... * dpm/README, h/dpm_api.h: change prototype of dpm_reservespace() to be consistent with the other methods * test/: CounterFile, dpm/socketSuite, srmv2/srmv2Suite: First running versions of socketSuite and srmv2Suite. * dpm/dpm-qryconf.man: correct example * test/: CounterFile, File/CounterFile.pm: Some utilities for the testing stuff ... * socket/dpmcli/dpm-getreqstatus.c, socket/dpmcli/module.mk, socket/goputils/module.mk, test/srmv1/Imakefile, test/srmv1/my_dccp_in.sh, test/srmv1/my_dccp_out.sh, test/srmv1/my_rfcp_in.sh, test/srmv1/my_rfcp_out.sh, test/srmv1/srm_testJiri.c, test/srmv1/srmv1Suite, test/srmv2/Imakefile, test/srmv2/srm2_testAbortFiles.c, test/srmv2/srm2_testAbortRequest.c, test/srmv2/srm2_testChangeFileStorageType.c, test/srmv2/srm2_testCheckPermission.c, test/srmv2/srm2_testCompactSpace.c, test/srmv2/srm2_testCopy.c, test/srmv2/srm2_testExtendFileLifeTime.c, test/srmv2/srm2_testGet.c, test/srmv2/srm2_testGetRequestID.c, test/srmv2/srm2_testGetRequestSummary.c, test/srmv2/srm2_testGetSpaceMetaData.c, test/srmv2/srm2_testGetSpaceToken.c, test/srmv2/srm2_testLs.c, test/srmv2/srm2_testMkdir.c, test/srmv2/srm2_testMv.c, test/srmv2/srm2_testPut.c, test/srmv2/srm2_testPutDone.c, test/srmv2/srm2_testReassignToUser.c, test/srmv2/srm2_testReleaseFiles.c, test/srmv2/srm2_testReleaseSpace.c, test/srmv2/srm2_testRemoveFiles.c, test/srmv2/srm2_testReserveSpace.c, test/srmv2/srm2_testResumeRequest.c, test/srmv2/srm2_testRm.c, test/srmv2/srm2_testRmdir.c, test/srmv2/srm2_testSetPermission.c, test/srmv2/srm2_testSuspendRequest.c, test/srmv2/srm2_testUpdateSpace.c: Second wave of modifications tp prepare merging of Test stuff into DPM tree. * socket/Makefile, socket/dpmcli/dpm-abortreq.c, socket/dpmcli/dpm-addfs.c, socket/dpmcli/dpm-copy.c, socket/dpmcli/dpm-extendfilelife.c, socket/dpmcli/dpm-get.c, socket/dpmcli/dpm-getpoolfs.c, socket/dpmcli/dpm-getpools.c, socket/dpmcli/dpm-getprotocols.c, socket/dpmcli/dpm-getreqid.c, socket/dpmcli/dpm-getreqstatus.c, socket/dpmcli/dpm-getreqsummary.c, socket/dpmcli/dpm-modifyfs.c, socket/dpmcli/dpm-put.c, socket/dpmcli/dpm-putdone.c, socket/dpmcli/dpm-relfiles.c, socket/dpmcli/dpm-replicate.c, socket/dpmcli/dpm-rm.c, socket/dpmcli/dpmestat.h, socket/dpmcli/dpmgdebug.h, socket/dpmcli/dpmgopts.h, socket/dpmcli/dpmutils.h, socket/dpmcli/module.mk, socket/goputils/dpm_utils.c, socket/goputils/gop_alloc.c, socket/goputils/gop_alloc.h, socket/goputils/gop_cach.c, socket/goputils/gop_cach.h, socket/goputils/gop_chan.h, socket/goputils/gop_clic.h, socket/goputils/gop_comm.h, socket/goputils/gop_devnm.h, socket/goputils/gop_escp.c, socket/goputils/gop_escp.h, socket/goputils/gop_glob.c, socket/goputils/gop_help.c, socket/goputils/gop_ksym.c, socket/goputils/gop_outp.c, socket/goputils/gop_pars.c, socket/goputils/gop_readf.h, socket/goputils/gop_selc.c, socket/goputils/gop_sig.c, socket/goputils/gop_sig.h, socket/goputils/gop_sortf.c, socket/goputils/gop_synfo.c, socket/goputils/gop_synfo.h, socket/goputils/gop_verf.c, socket/goputils/gop_verf.h, socket/goputils/module.mk, test/dpm/socketSuite, test/srmv1/Imakefile, test/srmv1/my_dccp_in.sh, test/srmv1/my_dccp_out.sh, test/srmv1/my_gsiftp_in.sh, test/srmv1/my_gsiftp_out.sh, test/srmv1/my_rfcp_in.sh, test/srmv1/my_rfcp_out.sh, test/srmv1/srm_testJiri.c, test/srmv1/srmv1Suite, test/srmv2/Imakefile, test/srmv2/srm2_testAbortFiles.c, test/srmv2/srm2_testAbortRequest.c, test/srmv2/srm2_testChangeFileStorageType.c, test/srmv2/srm2_testCheckPermission.c, test/srmv2/srm2_testCompactSpace.c, test/srmv2/srm2_testCopy.c, test/srmv2/srm2_testExtendFileLifeTime.c, test/srmv2/srm2_testGet.c, test/srmv2/srm2_testGetRequestID.c, test/srmv2/srm2_testGetRequestSummary.c, test/srmv2/srm2_testGetSpaceMetaData.c, test/srmv2/srm2_testGetSpaceToken.c, test/srmv2/srm2_testLs.c, test/srmv2/srm2_testMkdir.c, test/srmv2/srm2_testMv.c, test/srmv2/srm2_testPut.c, test/srmv2/srm2_testPutDone.c, test/srmv2/srm2_testReassignToUser.c, test/srmv2/srm2_testReleaseFiles.c, test/srmv2/srm2_testReleaseSpace.c, test/srmv2/srm2_testRemoveFiles.c, test/srmv2/srm2_testReserveSpace.c, test/srmv2/srm2_testResumeRequest.c, test/srmv2/srm2_testRm.c, test/srmv2/srm2_testRmdir.c, test/srmv2/srm2_testSetPermission.c, test/srmv2/srm2_testSuspendRequest.c, test/srmv2/srm2_testUpdateSpace.c, test/srmv2/srmv2Suite: First attempt to upload the whole test stuff produced by GG. * dpm/dpm_procreq.c: use rfio_serrno instead of rfio_errno * dpm/dpm_procreq.c, srmv1/srmv1_procreq.c, srmv2/srmv2_xferreq.c: generate rfio TURLS compatible with the CASTOR ones lcgdm-1.10.0/shlib/0000755000175000017500000000000013234072406013321 5ustar ellertellertlcgdm-1.10.0/shlib/Imakefile0000644000175000017500000000554712315306042015140 0ustar ellertellertCOMM @(#)$RCSfile: Imakefile,v $ $Revision: 10274 $ $Date: 2014-03-28 15:50:10 +0100 (Fri, 28 Mar 2014) $ CERN IT-PDP/DM Jean-Philippe Baud COMM COMM Copyright (C) 2000-2011 by CERN/IT/PDP/DM COMM All rights reserved COMM COMM Make DPM/LFC shared libraries GENERIC #include include FileName(..,VERSION) LIB = InstallLibDir COMM Archive symbol table entry name #if __osf__ && __alpha SYMTABNAM = ________64ELEL_ #else SYMTABNAM = __.SYMDEF #endif #if BuildNameServerAsLFC COMM Libraries to include in SharedLibraryTargetName(lfc) all: SharedLibraryTargetName(lfc) install: $(LIB) FileName($(LIB),SharedLibraryTargetName(lfc)) export: $(EXPORTLIB)/SharedLibraryTargetName(lfc) #else #if BuildNameServerAsDPNS COMM Libraries to include in SharedLibraryTargetName(dpm) all: SharedLibraryTargetName(dpm) install: $(LIB) FileName($(LIB),SharedLibraryTargetName(dpm)) export: $(EXPORTLIB)/SharedLibraryTargetName(dpm) #else #endif #endif COMM Libraries to include in SharedLibraryTargetame(lcgdm) all: SharedLibraryTargetName(lcgdm) install: $(LIB) FileName($(LIB),SharedLibraryTargetName(lcgdm)) export: $(EXPORTLIB)/SharedLibraryTargetName(lcgdm) exportman: exportshr: libdpm.sl libdpm.so libdpm.dylib: $(RFIOLIB) $(NSLIB) $(DPMLIB) liblfc.sl liblfc.so liblfc.dylib: $(NSLIB) %.sl %.so %.dylib: SharedLibraryTargetName(lcgdm) @echo " making $@ in `pwd`" @-rm -rf tmp.$@ @mkdir tmp.$@ @for i in $^ ;\ do (cd tmp.$@; case $$i in *.a) $(AR) x ../$$i; rm -f $(SYMTABNAM) ;; esac) done (cd tmp.$@; $(CC) $(SHLIBLDFLAGS) SonameOption($@,`echo $(VERSION)|cut -f1 -d.`) -o ../$@ *.o -L.. -llcgdm $(LIBCSEC)) @-rm -rf tmp.$@ liblcgdm.sl liblcgdm.so liblcgdm.dylib: $(COMMONLIB) $(SECURITYLIB) @echo " making $@ in `pwd`" @-rm -rf tmp.$@ @mkdir tmp.$@ @for i in $^ ;\ do (cd tmp.$@; $(AR) x ../$$i; rm -f $(SYMTABNAM)) done (cd tmp.$@; $(CC) $(SHLIBLDFLAGS) SonameOption($@,`echo $(VERSION)|cut -f1 -d.`) -o ../$@ *.o $(SHLIBREQLIBS) $(LIBCSEC) -ldl -lstdc++) @-rm -rf tmp.$@ libdpm.dll: $(RFIOLIB) $(NSLIB) $(DPMLIB) liblfc.dll: $(NSLIB) liblcgdm.dll: $(COMMONLIB) $(SECURITYLIB) %.dll: @echo making $@ in CurDir link /dll /noentry /nologo /out:$@ $** MakeDir($(LIB),root,bin,0755) InstallSharedLibrary(dpm,$(VERSION),$(LIB)) InstallSharedLibrary(lfc,$(VERSION),$(LIB)) InstallSharedLibrary(lcgdm,$(VERSION),$(LIB)) InstallSharedLibrary(dpm,$(VERSION),$(EXPORTLIB)) InstallSharedLibrary(lfc,$(VERSION),$(EXPORTLIB)) InstallSharedLibrary(lcgdm,$(VERSION),$(EXPORTLIB)) install.man: #if _WIN32 clean: @echo cleaning in CurDir -@RemoveFiles(FilesToClean) #else clean: @echo cleaning in CurDir -@RemoveFiles(FilesToClean) -@rm -rf tmp.* > /dev/null 2>&1 #endif clobber: clean Makefiles: MakeDepLibrary(common,common) MakeDepLibrary(rfio,rfio) MakeDepLibrary(ns,ns) MakeDepLibrary(dpm,dpm) MakeDepLibrary(security,security) FORCE: lcgdm-1.10.0/interfaces/0000755000175000017500000000000013234072376014351 5ustar ellertellertlcgdm-1.10.0/interfaces/README0000644000175000017500000000067710322757062015240 0ustar ellertellertHow to build the LFC/DPM Interfaces =================================== Based on first draft : 11/07/2005 (sophie.lemaitre@cern.ch) This version 20/07/2005 (david.smith@cern.ch) Last update : 11/10/2005 (sophie.lemaitre@cern.ch) The LFC and DPM Perl and Python Interfaces are now built using the main RPM building process : > cd LCG-DM > ./configure > make rpm Note : swig 1.3, Perl 5 and Python 2.2 have to be installed at build time. ------ lcgdm-1.10.0/Imakefile0000644000175000017500000000663211763665646014063 0ustar ellertellertCOMM @(#)$RCSfile: Imakefile,v $ $Revision: 1.34 $ $Date: 2009/02/18 23:14:09 $ CERN IT-PDP/DM Jean-Philippe Baud COMM COMM Copyright (C) 1990-2008 by CERN/IT/PDP/DM COMM All rights reserved COMM COMM Make DPM/LFC libraries and executables #include include VERSION #if BuildNameServerAsLFC PACKAGE = LFC #else #if BuildNameServerAsDPNS PACKAGE = DPM #else PACKAGE = lcg-dm-common #endif #endif #if UseOracle SPECFILE = $(PACKAGE)-oracle.spec #else #if UsePostgres SPECFILE = $(PACKAGE)-postgres.spec #else SPECFILE = $(PACKAGE).spec #endif #endif SUBDIRS = h $(LIBDIR) $(SHLIBDIR) $(COMMONDIR) $(NSDIR) $(RFIODIR) $(DPMDIR) \ $(SRMV1DIR) $(SRMV2DIR) $(SRMV2_2DIR) $(SECURITYDIR) $(DLIDIR) \ $(DICOMCOPYDIR) $(DPMCOPYDIR) #if BuildSecurity SECURITY = sec #endif distdir = $(PACKAGE)-$(VERSION) sources = Imakefile Makefile.ini Makefile.ini.Win32 README VERSION \ config test setosflags configure doc scripts $(SUBDIRS) EXPORTSUBDIRS = $(LIBDIR) $(SHLIBDIR) $(COMMONDIR) $(NSDIR) h DEPENDDIRS = $(COMMONDIR) $(NSDIR) $(RFIODIR) $(DPMDIR) $(SRMV1DIR) $(SRMV2DIR) \ $(SRMV2_2DIR) $(SECURITYDIR) $(DLIDIR) $(DICOMCOPYDIR) $(DPMCOPYDIR) EXPORTBIN=$(EXPORT)/bin EXPORTSBIN=$(EXPORT)/sbin EXPORTLIB=$(EXPORT)/lib EXPORTINC=$(EXPORTSHR)/include EXPORTH=$(EXPORTINC)/shift MakeSubdirs(all,$(SUBDIRS)) MakeSubdirs(install,$(SUBDIRS)) MakeSubdirs(install.man,$(SUBDIRS)) MakeSubdirs(clean,$(SUBDIRS)) MakeSubdirs(clobber,$(SUBDIRS)) export: (if [ "x$(EXPORT)" = "x" ] ; \ then \ echo "EXPORT must be set (thru make or environment)" ; exit 1 ; \ else \ echo "exporting to $(EXPORT)" ; \ fi ; \ for i in $(EXPORTSUBDIRS) ;\ do (echo " $$i (EXPORT):" ; cd $$i ; \ $(MAKE) $(MFLAGS) EXPORTSBIN=$(EXPORTSBIN) EXPORTBIN=$(EXPORTBIN) EXPORTLIB=$(EXPORTLIB) $@ ; \ ) ; done ; \ ) ; exportman: (if [ "x$(EXPORTMAN)" = "x" ] ; \ then \ echo "EXPORTMAN must be set (thru make or environment)" ; exit 1 ; \ else \ echo "exporting to $(EXPORTMAN)" ; \ fi ; \ for i in $(EXPORTSUBDIRS) ;\ do (echo " $$i (EXPORTMAN):" ; cd $$i ; \ $(MAKE) $(MFLAGS) EXPORTMAN=$(EXPORTMAN) $@ ; \ ) ; done ; \ ) ; exportshr: (if [ "x$(EXPORTSHR)" = "x" ] ; \ then \ echo "EXPORTSHR must be set (thru make or environment)" ; exit 1 ; \ else \ echo "exporting to $(EXPORTSHR)" ; \ fi ; \ for i in $(EXPORTSUBDIRS) ;\ do (echo " $$i (EXPORTSHR):" ; cd $$i ; \ $(MAKE) $(MFLAGS) EXPORTSHR=$(EXPORTSHR) EXPORTINC=$(EXPORTINC) EXPORTH=$(EXPORTH) $@ ; \ ) ; done ; \ ) ; #if defined(_WIN32) test: Makefiles cd test & $(MAKE) all & cd .. Makefiles: @for %i in ( $(SUBDIRS) test ) \ do @(echo %i - & cd %i & \ imake -Ui386 -I..\config ; \ $(MAKE) $(MFLAGS) $@ & cd .. ) depend: @echo Not supported on this platform #else test: Makefiles (cd test; $(MAKE) all) Makefiles: @. ./setosflags ;\ for i in $(SUBDIRS) test ;\ do (echo " $$i:" ; cd $$i ;\ imake -I../config -DOSMajorVersion="$$OSMAJNO" -DOSMinorVersion="$$OSMINNO" ;\ $(MAKE) $(MFLAGS) $@ \ ) ; done ; depend: for i in $(DEPENDDIRS) test ;\ do (echo " $$i:" ; cd $$i ;\ $(MAKE) $(MFLAGS) $@ \ ) ; done ; dist: -rm -rf $(distdir) mkdir $(distdir) -cp -rp $(sources) $(distdir) tar cvzf $(distdir).src.tar.gz $(distdir) -rm -rf $(distdir) OS=$(shell scripts/get-platform-os) rpm: $(MAKE) -C rpm rpm-$(PACKAGE)-mysql rpm-oracle : $(MAKE) -C rpm rpm-$(PACKAGE)-oracle rpm-postgres : $(MAKE) -C rpm rpm-$(PACKAGE)-postgres #endif lcgdm-1.10.0/CHANGES0000644000175000017500000006164211763665646013247 0ustar ellertellert# # Keep this file meaningful : # - description of "big" changes, # - bugs fixed, with bug number and description, # - tag dates. # # See CHANGES-long for more details. # 2012-04-30 - rocha - Fixed build for oracle (trac #508) 2012-04-03 - rocha - Added thread safe CSEC_MECH (trac #263) 2012-04-03 - rocha - Packaging is now Fedora compliant (trac #274) 2012-04-03 - rocha - Added synchronous dpm_get support (trac #295) 2012-04-03 - rocha - Added support for MySQL 5.5 for the db creation script (trac #346) 2012-04-03 - rocha - SRMv1 is now disabled by default (trac #363) 2012-04-03 - rocha - Added sample my.cnf configuration file (trac #403) 2011-07-01 - baud - treat "Oracle password soon to expire" as success (bug #46337) 2011-06-23 - baud - LFC_oracle fails to start when the connection string is too long (bug #83551) 2011-06-20 - baud - Parse the DB config file in the DB module and not in the daemon itself 2011-06-20 - baud - Add the possibility to send logs to syslog and have log levels (bug #83411) 2011-06-15 - baud - Bug in LFC 1.8.0 in read only mode (bug #82941) 2011-06-15 - baud - add missing rfstat man page (bug #83247) 2011-06-15 - baud - fix startup script when logfile does not contain a slash (bug #77388) 2011-05-19 - baud - DPM filesystem selection based on assign weights (bug #82361) 2011-05-19 - baud - No error message if too many groups specified in dpm-modifypool (bug #82339) 2011-05-18 - baud - change d_name declaration from d_name[1] to d_name[256] (bug #82403) 2011-04-21 - baud - 1.8.1-2 tag 2011-04-12 - baud - The condrestart action in the init.d startup scripts is not conditional (bug #76695) 2011-04-11 - baud - add --si option to dpm-listspaces 2011-04-07 - baud - 1.8.1-1 tag 2011-04-04 - baud - add --si option to dpm-reservespace and dpm-updatespace (A. Forti) 2011-03-15 - baud - Feature request for dpns-ls -h (human readable) (bug #20298) 2011-03-10 - baud - 1.8.1 tag 2011-03-10 - baud - No sonames in libraries (bug #57528) 2011-03-08 - baud - set AutoReqProv = yes (strong requirement from EMI project) 2011-03-08 - baud - fix GlueSAExpirationMode when space is Volatile or Durable (GGUS #67503) 2011-03-03 - baud - DPM 1.8: dpm-modifyfs --st RDONLY doesn't update FS (bug #78968) 2011-03-02 - baud - first attempt to provide glue 2.0 support in dpm-listspaces 2011-02-15 - baud - add option to dpm-drain to transfer multiple files at same time (bug #61037) 2011-02-15 - baud - Increase performance of dpm-drain by using RFIO instead of gridFTP (bug #60109) 2011-02-15 - baud - srm2.2 srmLs (SRM_TOO_MANY_RESULTS and application of count limit) (bug #46961) 2011-02-11 - baud - srmv1 and srmv2.2 segfaults while security scan (bug #77984) 2011-02-02 - baud - Allow to define the number of threads for DPM and SRM servers at startup time (bug #77655) 2010-11-10 - baud - retrial for root requests after db reconnection (bug #75064) 2010-11-05 - baud - 1.8.0-1 tag 2010-10-26 - baud - set retry count to 0 in dpm-shutdown to avoid init script hang when pid file is present and daemon is not running 2010-10-25 - baud - logging timestamps at millisecond level (bug #49997) 2010-10-08 - baud - 1.8.0 tag 2010-10-03 - baud - Please make symlinks within python-dpm relative (bug #73077) 2010-09-21 - baud - fix memory leak in lfc bulk methods (bug #74610) 2010-09-07 - baud - servers crash when client passes too many FQANs in the proxy (bug #72382) 2010-09-07 - baud - Extra information (host, status) to be returned by lfc_getreplicas (bug #72361) 2010-08-30 - baud - possibility to set an environment variable RFIO_TRACEFILE 2010-08-30 - baud - possibility to set the log level when starting rfiod (option -L) 2010-08-30 - baud - new method rfio_rcp (third party rfcp) 2010-08-04 - baud - banning of users and groups (bug #43710) 2010-07-14 - baud - use finger to determine home directory only when starting service (bug #69716) 2010-06-07 - baud - remove bashisms in LFC/DPM init scripts (bug #68430) 2010-05-24 - baud - 1.7.4-7 tag 2010-05-26 - baud - support gsoap versions > 2.7.15 (bug #67796) 2010-05-18 - baud - avoid srmv2.2 daemon crash when permission denied on a GetSpaceMetadata 2010-04-30 - baud - avoid rfio_lseek64 error after hitting eof in pre-read mode 2010-04-29 - baud - 1.7.4-6 tag 2010-04-23 - baud - SURLs bulk lookup in LFC (bug #60796) 2010-04-20 - baud - 1.7.4-5 tag 2010-04-20 - baud - remove dpm-drain multi-threaded feature because of hangs discovered at LAL 2010-04-16 - baud - number of DB connections can exceed the number of configured threads because of a missing ROLLBACK WORK RELEASE in closedb (BNL LFC problem) 2010-04-13 - baud - fix rewinddir method broken by LFC/DPM 1.7.3 (bug #65514) 2010-04-13 - baud - fix rfcp hang 2010-04-05 - baud - Man page typos and glitches (bug #65298) 2010-04-03 - baud - Makefile typo (bug #65297) 2010-03-08 - baud - 1.7.4-4 tag 2010-03-10 - baud - fix free space reporting in dpm-listspaces (GGUS #54818 and GGUS #56150) 2010-03-08 - baud - 1.7.4-3 tag 2010-03-08 - baud - split shared libraries from CLIs to allow coexistence of 32bits and 64bits libraries (bug #56619) 2010-03-05 - baud - give more precise error message in setacl (GGUS #56192) 2010-02-25 - baud - 1.7.4-2 tag 2010-02-24 - baud - controlling the number of retries in DPM API (bug #32091) 2010-02-23 - baud - fix srmSetPermissions when changing groupowner (GGUS #50779) 2010-02-22 - baud - set daemons mode to 0755 (bug #57531) 2010-02-22 - baud - Suppress the need for grid-mapfile and gridmapdir in SRM servers. This fixes the bug #33899. 2010-02-18 - baud - add support for Debian in startup scripts (bug #57532) 2010-02-18 - baud - fix restart option, it was failing if the daemon was already stopped (bug #55339) 2010-02-18 - baud - startup script assumes /home when it shouldn't (bug #45002) 2010-02-15 - baud - allow setting of RFIO buffersize on client side (bug #56166) 2010-02-12 - baud - RFIO code cleanup 2010-02-05 - baud - do not lookup virtual ids with getpwuid/getgrgid in rfstat, rfdir (bug #48250) 2010-02-05 - baud - remove trailing slashes in filesystem names for addfs, modifyfs, rmfs (bugs #39279 and #58716) 2010-02-05 - baud - do not format man pages with nroff by default (bugs #33692, #33693, #57533) 2010-02-05 - baud - document that '-' is an an acceptable value for space type in addpool and modifypool (bug #50760) 2010-02-04 - baud - change targets to be able to use parallel make (bug #57534) 2009-12-17 - dhsmith - tagged 1.7.4-1 2009-12-17 - dhsmith - Change rfiod init.d script for bug #57229 2009-12-14 - dhsmith - Made dpm-drain multithreaded (bug #61037), ongoing work towards #60109 2009-12-08 - dhsmith - Fix for bug #60299, #55987 2009-11-18 - dhsmith - Fix for bug #56630 "Inconsistent man location" 2009-11-13 - dhsmith - Periodic cleanup of historic put,get,copy requests from the dpm database 2009-10-19 - dhsmith - Cnetdb.c, do not append trailing period during forward name lookup 2009-10-19 - baud - change error and/or message for srmCopy or dpm_get on directory (committed by dhsmith) 2009-10-16 - dhsmith - change etics configuration template to use swig 1.3.31 for python 2.5 interfaces 2009-10-07 - dhsmith - mirror fix for bug found in castor ns, #56212 2009-09-04 - dhsmith - tagged 1.7.3-1 2009-09-03 - dhsmith - add dpm_client_resetAuthorizationId() and prototypes for Cns/dpm 2009-08-28 - dhsmith - in Csec_api.c remove semicolon from preprocessor substitued variable declaration 2009-08-27 - dhsmith - fix for bug #54848: srmLs should return proper checksum algorithms 2009-08-24 - akos - new liblcgdm.so from objects of 'security' and 'common' out of libdpm.so and liblfc.so 2009-08-21 - dhsmith - ammend old bug fix #19878 (problems on some non SL4/SL5 platforms) 2009-08-19 - dhsmith - fix for bug #50397 (crash of ns with malformed request) 2009-08-19 - akos - fix for bug #54542: changing to Apache License 2.0 2009-08-19 - dhsmith - fix for bug #53568: srm daemon can attempt to use DB connection before it is opened 2009-06-25 - dhsmith - fix for bug #50818 (malformed acl entry in db crashed lfcdaemon) 2009-06-25 - dhsmith - fix for bug #39280: dpm_getspacetokens() returns an error message when no token exists 2009-06-09 - mjouvin - updated dpm-listspaces to 1.3.1-7, fixes #50962, #51530 (committed by akos) 2009-06-02 - akos - tagged 1.7.2-5 2009-05-28 - rmollon - fix for bug #50977: Swig/Python wrapper problem on SL5 2009-05-06 - akos - added e2fsprogs-libs RPM dependency (fixes bug#50045) 2009-04-23 - dhsmith - tagged 1.7.2-4 2009-04-23 - rmollon - allow for new swig library location for SLC5 build 2009-04-22 - dhsmith - tagged 1.7.2-3 2009-04-22 - baud - fixes for savannah 49345 and ggus 48060 2009-04-21 - dhsmith - removed conflict clause between LFC/DPM-interfaces-py25 and LFC/DPM-interfaces 2009-04-20 - dhsmith - fix for bug #49369 2009-04-20 - dhsmith - package symbolic links in interfaces rpm package rather than create during postscript 2009-04-07 - dhsmith - tagged 1.7.2-2 2009-04-07 - dhsmith - removed dli dependency on cgsi for the LFC 2009-04-06 - dhsmith - tagged 1.7.2-1 2009-04-06 - baud - new methods registerfiles and delreplicasbysfn (47049, committed by dhsmith) 2009-03-20 - dhsmith - 1.7.1-1 tag (also branch point as of 2009-04-20) 2009-03-17 - baud - added option to rfiod to specify local hostname used in dpns queries 2009-03-16 - dhsmith - fix typo in prototype.lfcclient 2009-03-12 - baud - fix in Cns_libpq_ifce.c 2009-02-25 - dhsmith - exit immediatly on error from dpm_getpoolfs() or dpm_modifyfs() in dpm-drain 2009-02-25 - dhsmith - change warning message for populated and deleted files during dpm-drain 2009-02-25 - dhsmith - clear checksum type and value on file reset in Cns_srv_creat 2009-01-27 - baud - Improved portability of init scripts (fixes bug#43334). 2009-01-27 - dhsmith - rewrote the text of a Csec error message to clarify 2009-01-09 - dhsmith - initial round of changes for solaris build 2009-01-09 - dhsmith - use vomsapi rather than vomsc and specify globus version in nonthr case (45891) 2009-01-08 - akos - moved RPM specific files into 'rpm' subdirectory 2009-01-08 - akos - building the interfaces in Python2.5 flavour 2009-01-07 - dhsmith - do not lookup ns/dpm/rfiod/dpmcopyd/dicomcopyd ports with getservbyname (43128, 42592) 2009-01-06 - rmollon - fix bug 45422: dpm.i to dpm_wrap.c creation using swig-1.3.29-2.1 results in errors 2008-12-18 - dhsmith - Check for more errors while reading request from network (45892) 2008-12-16 - dhsmith - Update dpm-listspaces to v1.3.1-4 (fixes 45814) 2008-12-16 - dhsmith - Fix memory leak in dpm_get_max_get_lifetime(), bug 45812 2008-12-08 - dhsmith - Correct problem with bug fix 40553 2008-11-25 - dhsmith - Fixes for 43382 / castor 43769 and 29444 2008-10-30 - dhsmith - 1.7.0-5 tag 2008-10-30 - dhsmith - moved dpm-listspaces to version 1.3.1-2 2008-10-30 - dhsmith - do not build lfc2/dpm2 interfaces 2008-10-29 - dhsmith - change transaction handling during put and space update during delete 2008-10-29 - dhsmith - fix bug 43332 2008-10-27 - dhsmith - 1.7.0-3 tag 2008-10-27 - dhsmith - restore relonefile pfn check (needed for bringonline release) 2008-10-23 - dhsmith - 1.7.0-2 tag 2008-10-23 - dhsmith - check for deleted space during dpm-drain 2008-10-23 - dhsmith - change dpm_relonefile() to fail if no pfn to release 2008-10-23 - dhsmith - correctly pass ENOENT error during put 2008-10-16 - dhsmith - 1.7.0-1 tag 2008-10-15 - dhsmith - added extra logging to dpm_upd_u_space 2008-10-13 - dhsmith - fix for nsls when listing comments, castor bug 42631 2008-10-09 - dhsmith - update dpm-listspaces to allow for multiple groups on spaces 2008-10-09 - rmollon - add support of lfc_getlinks and dpns_getlinks in old lfc/dpm python API 2008-10-08 - rmollon - filesize arg can now be either int or long in python 2008-10-08 - rmollon - fix swig typemaps syntax to be compliant with swig for sl5 2008-10-07 - dhsmith - add db schema migration utilities, use ns filesize for space adjustment 2008-09-25 - dhsmith - added client_dn to dpm_space_metadata 2008-09-23 - dhsmith - preparing for 1.7 series: incorporating new features, main author baud; 2008-09-23 - dhsmith - New module: dpmcopy service for handling srmCopy requests 2008-09-23 - dhsmith - Multiple groups can be associated to spaces and will be used during write permission check 2008-09-23 - dhsmith - Allow srm 2.2 srmReleaseFiles method to operate without a requestToken 2008-09-23 - dhsmith - srm 2.2 srmLs can now return the space tokens associated with a file 2008-09-19 - dhsmith - 1.6.12-1 tag 2008-09-19 - dhsmith - added Cns_setfsizec call (previous development from baud) 2008-09-18 - dhsmith - add dpm-listspaces and man page 2008-09-01 - dhsmith - remove file entries on removing last replica, bug #40927 2008-09-01 - dhsmith - remove lfc2/dpm2 python interface from packaging for now 2008-08-25 - dhsmith - replication of volatile files during dpm-drain, bug #40553 2008-08-25 - dhsmith - preserve space token during draining, bug #40273 2008-08-08 - akos - 1.6.11-5 tag 2008-08-01 - rmollon - addition of lfc2/dpm2 python interface 2008-07-08 - akos - 1.6.11-4 tag 2008-07-07 - rmollon - fix reading of gids & free fields from the dpm_pool struct via the python API 2008-06-24 - akos - 1.6.11-1 tag 2008-06-23 - dhsmith - return space to pool when removing a replica in a space that no longer exists 2008-06-23 - dhsmith - fix for crash in scan_interfaces, for bug #38067 2008-06-19 - dhsmith - disfavour filling filesystems to more than 98 percent of capacity during selection 2008-06-17 - dhsmith - dpm-drain: ctrl-c handling, option to limit size plus fixes for bugs 31385, 31390 2008-06-13 - dhsmith - add man page for rfdf command, bug #36707 2008-06-11 - dhsmith - fix internal client function rfio_preread64() for bug #37691 2008-06-11 - dhsmith - minor bounds checking changes in dpm, ns and Csec 2008-06-11 - dhsmith - return a network time out error to client rather than internal error in some circumstances 2008-06-11 - dhsmith - apply castor ns fix for bug #31342, for consistency between lcg-dm and castor 2008-06-10 - dhsmith - fix dpm_updfreespace() to still update fs space under some conditions, bug #36556 2008-06-10 - dhsmith - check space type specified by the user is valid when adding or modifying pool, bug #35876 2008-06-04 - dhsmith - leave unspecified values unchanged in dpm-updatespace.c (CLI), bug #36652 2008-06-04 - dhsmith - protect srm2 servers against crash in srmSetPermission, bug #36849 2008-06-04 - dhsmith - add read only check on 5 nameserver methods, fixes bug #36706 2008-06-04 - dhsmith - remove popen functionality from rfio 2008-05-27 - dhsmith - 1.6.10-6 tag (only double free fix wrt 1.6.10-4) 2008-05-27 - dhsmith - change in _Csec_recv_token to avoid subsequent double free 2008-04-14 - dhsmith - reopen and preserve first 3 file descriptors in rfio_serv.c and Cinitdaemon.c 2008-04-14 - dhsmith - consistency fix in rfio_calls.c rfio_call64.c for method of returning from sropen*_v3 2008-04-14 - akos - 1.6.10-5 tag 2008-04-14 - akos - enabling build with gSOAP v2.7.10 2008-03-18 - akos - 1.6.10-4 tag 2008-03-10 - baud - security fix for #34664 2008-03-07 - dhsmith - fix for castor bug #31028 2008-03-06 - baud - fix bug #33920, #33921, #33923: compilation with Krb5 and virtual ids 2008-03-04 - baud - fix CASTOR bug #1441: nlink incorrect if rename target exists already 2008-03-03 - akos - 1.6.10-3 tag 2008-03-03 - akos - fixes for Oracle init scripts on x86_64 2008-02-29 - akos - fixes bug#33191 for Oracle: added migrate-oracle-schema-to-2-3-0.sql 2008-02-25 - akos - 1.6.10-1 tag 2008-02-25 - baud - group writable directories when SRM started with umask 0 2008-02-25 - baud - fixed bug #33769: incorrect pool free space after dpm-drain 2008-02-18 - baud - fix problem of replication of a zero-length file improve logging of updatefilestatus method 2008-02-18 - akos - fixes bug #32818: Adding man page of getreplicasl to the package and syncing up the ordering 2008-02-18 - akos - fixes bug #18836: Removing the last references to /etc/passwd and /etc/group in the man pages 2008-02-18 - akos - fixes bug #32981: MySQL and Oracle flavours of the same service should conflict 2008-02-18 - akos - fixes bug #32978, #31157 and ggus#31741: Changing the LDAP DN of the published service from mds-vo-name=local to mds-vo-name=resource 2008-01-17 - dhsmith - network receive timeout for DLI and SRMs of 5 minutes 2008-02-11 - baud - support for MacOSX 2008-01-14 - baud - DICOM back-end service for DPM 2008-01-14 - akos - producing re-buildable source RPMs 2008-01-11 - akos - 1.6.9-1 tag 2008-01-10 - dhsmith - fix problem of wrong clienthost in dpm_db reported by Jiri Chudoba 2008-01-10 - dhsmith - explicitly disallow ':' character in filesystem server names, when adding pools 2008-01-10 - dhsmith - support IPv6 in all services and clients 2008-01-10 - dhsmith - internal Csec protocol change for clearer logging (backward compatible) 2008-01-10 - dhsmith - general logging improvements 2008-01-10 - dhsmith - rfio fix for potential file truncation (see CASTOR bug#30223) 2008-01-09 - akos - 1.6.8-1 tag 2008-01-09 - baud - fixed bug #29512: add CLI to list space tokens and associated metadata 2007-12-21 - baud - fixed bug #31697: LFC daemon crashes with incorrect command from client 2007-12-20 - baud - add new bulk method for LHCb 2007-12-13 - baud - add new bulk methods for Atlas 2007-12-13 - baud - fixed bug #30234: lfc-modifyusrmap returns "Internal Error" - unique constraint violated 2007-12-13 - baud - fixed bug #29511: Add a command line tool to list virtual uids and gids defined 2007-12-10 - labadie - fixed bug #31981: error in MySQL SQL statements 2007-12-06 - slemaitr - fixed bug #31976: [LFC] "-n" option missing from init.d and sysconfig files 2007-12-04 - dhsmith - remove 64 to 32 open/stat/statfs, open v3 to v2, "secure" to original 32 bit stat fallbacks 2007-12-04 - dhsmith - do not check return code of setgroups() in rfio_calls.c 2007-11-02 - akos - 1.6.7-1 tag 2007-10-31 - baud - fixed bug #20595: DPM cannot reconnect to mysql 2007-10-31 - slemaitr - fixed bug #24493: bugs LFC Oracle script errors 2007-10-31 - rmollon - fixed bug #27590: cannot load python/perl dpm module 2007-10-31 - baud - fixed bug #30669: LFC/DPM have difficulties with a DN containing a ' 2007-10-17 - rmollon - DPM Python interface 2007-10-16 - dhsmith - addition to rfio_api.h due to fix for bug #30249 (fix primarily in the DPM-DSI module) 2007-09-21 - labadie - fixed bug #25065 : add option group and gid to dpm-drain 2007-09-13 - harakaly - fixed bug #20880: man lfc_python : lfc_readdirxr : Example contains big errors 2007-07-31 - slemaitr - 1.6.6-2 tag 2007-07-31 - dhsmith - removed VOMS/threading workaround, unnessary with VOMS api >= 1.7.20; fixes bug #28838 2007-07-31 - dhsmith - fixed bug #19878: DNs with "." are not properly handled 2007-07-20 - baud - fixed bug #27627: dpm-updatespace does not work when token_desc supplied 2007-07-12 - akos - 1.6.6-1 tag 2007-07-12 - baud - man page for the Cns_accessr() function 2007-07-11 - baud,akos - gSOAP 2.6.2 -> 2.7.6b upgrade 2007-07-10 - slemaitr - fixed bug #27810: Some lfc-file-catalog service types do not have GlueServiceUniqueID attribute set 2007-06-28 - akos - 1.6.5-4 tag 2007-06-28 - akos - RPM dependencies on SLC3 are slightly different - fix in spec file 2007-06-22 - akos - 1.6.5-3 tag 2007-06-22 - baud - better logging of request and sub-request (file) errors 2007-06-21 - akos - disabled automatic RPM dependencies to solve the x86_64 related problems 2007-06-19 - akos - build fixes for Suse9, Centos4 and easing optional build of Oracle parts 2007-06-13 - akos - 1.6.5-2 tag 2007-06-07 - slemaitr - fixed bug #26987: configure_node shows DPM database password in output on upgrade 2007-05-30 - akos - 1.6.5-1 tag 2007-05-21 - baud - remove expired spaces 2007-05-14 - baud - avoid crash in dpm_errmsg/Cns_errmsg when supplied buffer is too small (GGUS ticket 21767) 2007-05-09 - baud - correct processing of rfio_access on DPM TURLs (Atlas) 2007-05-09 - baud - return DPM version in otherInfo field of srmPing response 2007-05-09 - baud - dpm-shutdown: take "server" into account 2007-05-09 - baud - add methods ping and getifcevers in LFC/DPM 2007-04-30 - baud - fixed bug #25830: add ACLs on disk pools 2007-04-30 - baud - dpm-qryconf: add option --group to display groupnames instead of gids 2007-04-30 - baud - dpm-qryconf: add option --proto to display supported protocols 2007-04-30 - baud - fixed bug #25810: dpm-qryconf: add option --si to display sizes in power of 10 2007-04-19 - baud - implement recursive srmLs and srmRmdir 2007-04-18 - akos - 1.6.4-3 tag 2007-04-17 - baud - fix SRMv2.2 PrepareToGet problem, when the first protocol is not supported 2007-04-13 - baud - fix DPNS crash in readdir 2007-04-04 - akos - 1.6.4-2 tag 2007-04-03 - baud - fix garbage collector thresholds checks (was not working if pool free space was negative, i.e. pool space overcommitted) 2007-03-29 - slemaitr - Removed GRIDMAP and GRIDMAPDIR variables from sysconfig and init.d files (for LFC and DPNS). 2007-03-27 - akos - 1.6.4 tag 2007-03-27 - slemaitr - added database migration scripts for DPM secondary groups support 2007-03-26 - baud - allow in srmMv to move a file to another directory giving the directory name as target 2007-03-23 - baud - If the free space in a pool or filesystem was already negative, it was still possible to reserve space 2007-03-21 - baud - fixed bug #24755: "client crash if dpm-modifypool --help" 2007-03-21 - baud - fixed bugs #15287 & #23051: "add support for secondary groups in LFC/DPM" 2007-03-21 - baud - report fileLocality in srmLs output (WLCG decision) 2007-03-21 - baud - return an error if attempt to extend lifetime of an already expired TURL 2007-02-21 - slemaitr - Python interface to DPNS 2007-02-20 - akos - 1.6.3 tag 2007-02-20 - slemaitr - dpm_put_filereq(f_lifetime) is updated by 1.6 migration script 2007-02-15 - baud - allow to rename file/directory between PrepareToPut and PutDone 2007-02-15 - baud - in SRM 2.2, first implementation of srmPurgeFromSpace 2007-02-12 - baud - in dpm-reservespace add the possibility to enter lifetimes as numbers with suffix 2007-02-12 - baud - add CLI dpm-releasespace and dpm-updatespace 2007-02-09 - baud - log status codes in DPM and SRM v2.2 logs 2007-02-08 - baud - in srmLs return lifetimeLeft, fileStorageType for a file at level 0 2007-02-05 - akos - 1.6.2 tag 2007-02-03 - baud - increase maximum length of filename components to 255 2007-02-03 - baud - allow special characters in replicas and links 2007-02-03 - baud - add check on file basename length 2007-02-01 - akos - fixed bug #23222 by using VOMS_ErrorMessage() 2007-01-19 - akos - 1.6.1 tag 2007-01-19 - slemaitr - added database migration scripts for 1.6 support 2007-01-17 - baud - fix check on voname length (GGUS 16579) 2007-01-17 - baud - fixed bug #22432: "new method lfc_getreplicas" 2007-01-15 - baud - fixed bug #22853: "allow to change the group keeping the owner unchanged" 2007-01-12 - baud - log soap_serve errors like VOMS errors 2007-01-11 - baud - set default number of levels for srmLs to 1 (instead of 0) 2007-01-09 - baud - add option --help to DPM CLIs (GGUS ticket 11225) 2007-01-09 - baud - more informative man page for dpm-drain (GGUS ticket 11225) 2007-01-08 - baud - fixed bug #18490: "correctly set permissions with rfmkdir if parent directories have default ACLs" 2006-12-24 - baud - 1.6.0 tag 2006-12-21 - grodid - first implememtation of SRM 2.2 tests 2006-12-21 - baud - first implementation of SRM 2.2 in DPM 2006-12-21 - baud - fixed bug #20594: "incorrect pool selection" 2006-12-21 - baud - fixed bug #19575: "GC removes Permanent files" 2006-12-20 - baud - fixed bug #20768: "negative free space" 2006-12-20 - baud - accept null user descriptions in getspacetoken method 2006-12-20 - baud - accept null request token in dpm_extendfilelife 2006-12-20 - baud - reject srmReleaseFiles on PrepareToPut/Copy requests 2006-12-20 - baud - handle correctly negative unused space in srmGetSpaceMetaData 2006-12-20 - baud - support srmReleaseFiles with NULL array of SURLs 2006-11-15 - baud - flush dpm-drain messages (GGUS ticket 15562) 2006-10-23 - baud - fix processing of DPM PROTOCOLS entry from shift.conf (xrootd) 2006-10-10 - slemaitr - fixed bug #19438: "Newly installed LFC doesn't publish information" 2006-09-27 - slemaitr - 1.5.10 tag 2006-09-27 - krzys - LFC: fixed Python interface (reported by Atlas) 2006-09-25 - slemaitr - DPM: init.d script bug fixed (failed to start on some nodes). 2006-09-19 - baud - fixed bug #19711: "Replication in DPM is currently not usable for load distribution" 2006-09-12 - slemaitr - 1.5.9 tag 2006-09-12 - baud - fixed bug #18784: "dpm-drain accepts --poolname and --server in the same invocation" 2006-09-11 - baud - fixed bug #18837: "LFC Internal error when NULL comment" 2006-09-11 - baud - fixed bug #19073: "dpm-addfs should require ADMIN privilege" 2006-09-11 - baud - fixed bug #18843: "DPM: wrong restriction of privileged operations?" 2006-09-01 - baud - fixed bug #19353: "log files cannot exceed 2 GB" 2006-08-28 - baud - fixed bug #19736: "Problem draining DPM filesystem" 2006-08-15 - slemaitr - fixed bug #18688: "DPM MySQL upgrade scripts uses hardcoded database name cns_db" 2006-08-11 - slemaitr - fixed bug #18689: "DPM MySQL upgrade script fails to upgrade schema version for 'dpm_db'" 2006-08-01 - baud - 1.5.8 tag lcgdm-1.10.0/debian/0000755000175000017500000000000013234072376013450 5ustar ellertellertlcgdm-1.10.0/debian/changelog0000644000175000017500000000060611343757762015334 0ustar ellertellertlcg-dm (1.7.4-2) stable; urgency=low * Split DPM and LFC packages into '*-client', 'lib*' and 'lib*dev' * Split DPM and LFC interfaces into separate python and perl packages -- Rocha Ricardo Thu, 04 Mar 2010 16:50:00 +0100 lcg-dm (1.7.1-1) stable; urgency=low * Initial release. -- Frohner Ãkos Fri, 13 Mar 2009 01:50:00 +0100 lcgdm-1.10.0/debian/rules0000755000175000017500000001025311355042505014522 0ustar ellertellert#!/usr/bin/make -f # # debian/rules for LCG-DM # # Copyright (c) Members of the EGEE Collaboration. 2004-2009. # GNU General Public License v2. # # Authors: # Akos FROHNER # Eamonn Kenny # Ricardo Rocha # include VERSION PYTHON_VERSION=$(shell python -c "import sys; print sys.version[:3]") PREFIX=/opt/lcg SHELL := sh -e SOURCE_DIR=lcg-dm-$(VERSION) SOURCE_TAR=$(SOURCE_DIR).tar.gz DM_COMMON_PACKAGING = \ debian/liblcgdm1.install \ debian/liblcgdm1.postinst \ debian/liblcgdm-dev.install LFC_PACKAGING = \ debian/lfc-client.install \ debian/liblfc1.install \ debian/liblfc1.postinst \ debian/liblfc-dev.install \ debian/liblfc-perl.install \ debian/python-lfc.install DPM_PACKAGING = \ debian/dpm-client.install \ debian/libdpm1.install \ debian/libdpm1.postinst \ debian/libdpm-dev.install \ debian/libdpm-perl.install \ debian/python-dpm.install $(SOURCE_TAR): rm -rf $(SOURCE_DIR); \ mkdir $(SOURCE_DIR); \ cp -rp Imakefile Makefile.ini Makefile.ini.Win32 README VERSION \ config imake test setosflags configure doc scripts \ h lib shlib common ns rfio dpm srmv1 srmv2 srmv2.2 security \ dli dicomcopy dpmcopy $(SOURCE_DIR); \ find $(SOURCE_DIR) -name .svn -print0 | xargs -0 rm -rf ; \ tar -czf $(SOURCE_TAR) $(SOURCE_DIR); \ rm -rf $(SOURCE_DIR) debian/liblcgdm1.install: debian/templates/liblcgdm1.install for t in debian/templates/*.*; do \ sed -e "s/@PYTHON.VERSION@/$(PYTHON_VERSION)/g; s/@lib@/$(LIBDIR)/g; s/@prefix@/\/opt\/lcg/g" $$t >debian/$$(basename $$t) ; \ done build: build-stamp builddm-common/$(SOURCE_DIR)/Makefile: $(SOURCE_TAR) debian/liblcgdm1.install dh_testdir mkdir -p builddm-common tar -C builddm-common -xzf $(SOURCE_TAR) cd builddm-common/$(SOURCE_DIR); \ export LD_LIBRARY_PATH=$(GLOBUS_LOCATION)/lib:$(LD_LIBRARY_PATH); \ ./configure --libdir=$(LIBDIR) --with-client-only dm $(EXTRA_CONFIGURE_OPTIONS) buildlfc/$(SOURCE_DIR)/Makefile: $(SOURCE_TAR) dh_testdir mkdir -p buildlfc tar -C buildlfc -xzf $(SOURCE_TAR) cd buildlfc/$(SOURCE_DIR); \ export LD_LIBRARY_PATH=$(GLOBUS_LOCATION)/lib:$(LD_LIBRARY_PATH); \ ./configure --libdir=$(LIBDIR) --with-client-only lfc $(EXTRA_CONFIGURE_OPTIONS) builddpm/$(SOURCE_DIR)/Makefile: $(SOURCE_TAR) dh_testdir mkdir -p builddpm tar -C builddpm -xzf $(SOURCE_TAR) cd builddpm/$(SOURCE_DIR); \ export LD_LIBRARY_PATH=$(GLOBUS_LOCATION)/lib:$(LD_LIBRARY_PATH); \ ./configure --libdir=$(LIBDIR) --with-client-only dpm $(EXTRA_CONFIGURE_OPTIONS) build-stamp: builddm-common/$(SOURCE_DIR)/Makefile buildlfc/$(SOURCE_DIR)/Makefile builddpm/$(SOURCE_DIR)/Makefile dh_testdir LD_LIBRARY_PATH=$(GLOBUS_LOCATION)/lib:$(LD_LIBRARY_PATH) $(MAKE) -C builddm-common/$(SOURCE_DIR) LD_LIBRARY_PATH=$(GLOBUS_LOCATION)/lib:$(LD_LIBRARY_PATH) $(MAKE) -C buildlfc/$(SOURCE_DIR) LD_LIBRARY_PATH=$(GLOBUS_LOCATION)/lib:$(LD_LIBRARY_PATH) $(MAKE) -C builddpm/$(SOURCE_DIR) touch $@ clean: dh_testdir dh_testroot rm -rf builddm-common builddpm buildlfc $(SOURCE_TAR) dh_clean build-stamp install-stamp \ $(DM_COMMON_PACKAGING) $(LFC_PACKAGING) $(DPM_PACKAGING) install: install-stamp install-stamp: build-stamp dh_listpackages dh_testdir dh_testroot dh_clean -k $(MAKE) -C builddm-common/$(SOURCE_DIR) prefix=$(CURDIR)/debian/tmp/opt/lcg install $(MAKE) -C builddm-common/$(SOURCE_DIR) prefix=$(CURDIR)/debian/tmp/opt/lcg install.man $(MAKE) -C buildlfc/$(SOURCE_DIR) prefix=$(CURDIR)/debian/tmp/opt/lcg install $(MAKE) -C buildlfc/$(SOURCE_DIR) prefix=$(CURDIR)/debian/tmp/opt/lcg install.man $(MAKE) -C builddpm/$(SOURCE_DIR) prefix=$(CURDIR)/debian/tmp/opt/lcg install $(MAKE) -C builddpm/$(SOURCE_DIR) prefix=$(CURDIR)/debian/tmp/opt/lcg install.man touch $@ binary-indep: binary-arch: install dh_testdir dh_testroot dh_install --sourcedir=debian/tmp --list-missing dh_installdocs dh_installexamples dh_strip dh_compress dh_fixperms dh_makeshlibs #dh_shlibdeps #dh_perl /opt/lcg/$(LIBDIR)/perl #dh_pysupport /opt/lcg/$(LIBDIR)/python$(PYTHON_VERSION) dh_installchangelogs CHANGES dh_installdeb dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install lcgdm-1.10.0/debian/control0000644000175000017500000000605611344235114015051 0ustar ellertellertSource: lcg-dm Section: net Priority: optional Maintainer: project-eu-egee-glite-middleware@cern.ch Build-Depends: debhelper (>= 5.0.22), python-dev (>= 2.3), perl (>= 5.6), libc6-dev Standards-Version: 3.7.2 Package: liblcgdm-dev Section: libs Architecture: i386 amd64 Depends: liblcgdm1 (>= ${binary:Version}), glite-security-voms-api-cpp (>= 1.7.24) Description: Development files for common LCG DM components (LFC / DPM) Package: liblcgdm1 Section: libs Architecture: i386 amd64 Depends: glite-security-voms-api-cpp (>= 1.7.24), ${shlibs:Depends} Description: Common libraries for LFC and DPM The liblcgdm package contains common libraries and man pages that are useful for the LCG Data Management components, the LFC (LCG File Catalog) and the DPM (Disk Pool Manager) Package: lfc-client Section: utils Architecture: i386 amd64 Depends: liblfc1 (>= ${binary:Version}) Description: Command line utilities for LFC Package: liblfc1 Section: libs Architecture: i386 amd64 Depends: liblcgdm1 (>= 1.7.0), ${shlibs:Depends} Description: Libraries for LFC Package: liblfc-dev Section: libdevel Architecture: i386 amd64 Depends: liblcgdm-dev (>= 1.7.0), liblfc1 (>= ${binary:Version}), glite-security-voms-api (>= 1.7.24) Description: Development files for LFC Package: liblfc-perl Section: libs Architecture: i386 amd64 Depends: liblfc1 (>= 1.7.0), ${perl:Depends} Description: Perl and Python interfaces for LFC The LCG File Catalog (LFC) allows to store files in a File System looking like structure. It allows you to create symbolic links to any file or directory stored in the LFC, as well as replicas. This is the perl interface to the LFC built with swig. Package: python-lfc Section: libs Architecture: i386 amd64 Depends: liblfc1 (>= 1.7.0), ${python:Depends} Description: Python interface for LFC The LCG File Catalog (LFC) allows to store files in a File System looking like structure. It allows you to create symbolic links to any file or directory stored in the LFC, as well as replicas. This is the python interface to the LFC built with swig. Package: dpm-client Section: utils Architecture: i386 amd64 Depends: libdpm1 (>= ${binary:Version}) Description: Command line utilities for DPM Package: libdpm1 Section: libs Architecture: i386 amd64 Depends: liblcgdm1 (>= 1.7.0), ${shlibs:Depends} Description: Library for DPM Package: libdpm-dev Section: libdevel Architecture: i386 amd64 Depends: liblcgdm-dev (>= 1.7.0), libdpm1 (>= ${binary:Version}), glite-security-voms-api (>= 1.7.24) Description: Development files for DPM Package: libdpm-perl Section: libs Architecture: i386 amd64 Depends: libdpm1 (>= 1.7.0), perl (>= 5.10) Description: Light weight Disk Pool Manager offering SRMv1, SRMv2 and socket interfaces. This is the perl interface to the DPM built with swig. Package: python-dpm Section: libs Architecture: i386 amd64 Depends: libdpm1 (>= 1.7.0), python (>= 2.3) Description: Light weight Disk Pool Manager offering SRMv1, SRMv2 and socket interfaces. This is the python interface to the DPM built with swig. lcgdm-1.10.0/debian/compat0000644000175000017500000000000211167145575014653 0ustar ellertellert5 lcgdm-1.10.0/debian/copyright0000644000175000017500000000123711343757762015416 0ustar ellertellertThis package was created by FROHNER Ãkos , Eamonn Kenny and Ricardo Rocha Fri, 13 Mar 2009 01:50:00 +0100 Copyright (c) Members of the EGEE Collaboration. 2004-2010. See http://www.eu-egee.org/partners/ for details on the copyright holders. The DPM and LFC are free software; you can redistribute it and/or modify it under the terms of the Apache License, Version 2.0. You should have received a copy of the Apache License 2.0 with your Debian GNU/Linux system, in /usr/share/common-licenses/Apache-2.0, or you may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 lcgdm-1.10.0/debian/templates/0000755000175000017500000000000013234072376015446 5ustar ellertellertlcgdm-1.10.0/debian/templates/libdpm1.install0000644000175000017500000000003211343757762020371 0ustar ellertellertopt/lcg/@lib@/libdpm.so.* lcgdm-1.10.0/debian/templates/liblcgdm1.postinst0000755000175000017500000000064311344235264021114 0ustar ellertellert#!/bin/sh set -e PREFIX=@prefix@ LIBDIR=@lib@ ARCH=`uname -m` if ( [ $ARCH == "x86_64" ] && [ $LIBDIR == "lib" ] ) || ( [ $ARCH != "x86_64" ] && [ $LIBDIR == "lib32" ] ); then touch /etc/ld.so.conf.d/liblcgdm1.conf if [ `grep -c ^$PREFIX/$LIBDIR /etc/ld.so.conf.d/liblcgdm1.conf` = 0 ]; then echo "$PREFIX/$LIBDIR" > /etc/ld.so.conf.d/liblcgdm1.conf [ -x "/sbin/ldconfig" ] && /sbin/ldconfig fi fi #DEBHELPER# lcgdm-1.10.0/debian/templates/libdpm-dev.install0000644000175000017500000001555111343757762021100 0ustar ellertellertopt/lcg/include/dpm/Castor_limits.h opt/lcg/include/dpm/Cnetdb.h opt/lcg/include/dpm/Cns_api.h opt/lcg/include/dpm/Cns_constants.h opt/lcg/include/dpm/Cns_struct.h opt/lcg/include/dpm/dpm_api.h opt/lcg/include/dpm/dpm_constants.h opt/lcg/include/dpm/dpm_struct.h opt/lcg/include/dpm/dpns_api.h opt/lcg/include/dpm/osdep.h opt/lcg/include/dpm/rfcntl.h opt/lcg/include/dpm/rfio.h opt/lcg/include/dpm/rfio_api.h opt/lcg/include/dpm/rfio_constants.h opt/lcg/include/dpm/rfio_errno.h opt/lcg/include/dpm/serrno.h opt/lcg/include/dpm/u64subr.h opt/lcg/@lib@/libdpm.so opt/lcg/@lib@/libdpm.a opt/lcg/share/man/man3/dpm_abortfiles.3 opt/lcg/share/man/man3/dpm_abortreq.3 opt/lcg/share/man/man3/dpm_addfs.3 opt/lcg/share/man/man3/dpm_addpool.3 opt/lcg/share/man/man3/dpm_copy.3 opt/lcg/share/man/man3/dpm_delreplica.3 opt/lcg/share/man/man3/dpm_extendfilelife.3 opt/lcg/share/man/man3/dpm_get.3 opt/lcg/share/man/man3/dpm_getifcevers.3 opt/lcg/share/man/man3/dpm_getpoolfs.3 opt/lcg/share/man/man3/dpm_getpools.3 opt/lcg/share/man/man3/dpm_getprotocols.3 opt/lcg/share/man/man3/dpm_getreqid.3 opt/lcg/share/man/man3/dpm_getreqsummary.3 opt/lcg/share/man/man3/dpm_getspacemd.3 opt/lcg/share/man/man3/dpm_getspacetoken.3 opt/lcg/share/man/man3/dpm_getstatus_copyreq.3 opt/lcg/share/man/man3/dpm_getstatus_getreq.3 opt/lcg/share/man/man3/dpm_getstatus_putreq.3 opt/lcg/share/man/man3/dpm_modifyfs.3 opt/lcg/share/man/man3/dpm_modifypool.3 opt/lcg/share/man/man3/dpm_ping.3 opt/lcg/share/man/man3/dpm_put.3 opt/lcg/share/man/man3/dpm_putdone.3 opt/lcg/share/man/man3/dpm_releasespace.3 opt/lcg/share/man/man3/dpm_relfiles.3 opt/lcg/share/man/man3/dpm_reservespace.3 opt/lcg/share/man/man3/dpm_rm.3 opt/lcg/share/man/man3/dpm_rmfs.3 opt/lcg/share/man/man3/dpm_rmpool.3 opt/lcg/share/man/man3/dpm_seterrbuf.3 opt/lcg/share/man/man3/dpm_updatespace.3 opt/lcg/share/man/man3/dpns_aborttrans.3 opt/lcg/share/man/man3/dpns_access.3 opt/lcg/share/man/man3/dpns_accessr.3 opt/lcg/share/man/man3/dpns_addreplica.3 opt/lcg/share/man/man3/dpns_addreplicax.3 opt/lcg/share/man/man3/dpns_chdir.3 opt/lcg/share/man/man3/dpns_chmod.3 opt/lcg/share/man/man3/dpns_chown.3 opt/lcg/share/man/man3/dpns_closedir.3 opt/lcg/share/man/man3/dpns_creat.3 opt/lcg/share/man/man3/dpns_delete.3 opt/lcg/share/man/man3/dpns_delreplica.3 opt/lcg/share/man/man3/dpns_delreplicasbysfn.3 opt/lcg/share/man/man3/dpns_endsess.3 opt/lcg/share/man/man3/dpns_endtrans.3 opt/lcg/share/man/man3/dpns_entergrpmap.3 opt/lcg/share/man/man3/dpns_enterusrmap.3 opt/lcg/share/man/man3/dpns_getacl.3 opt/lcg/share/man/man3/dpns_getcwd.3 opt/lcg/share/man/man3/dpns_getgrpbygid.3 opt/lcg/share/man/man3/dpns_getgrpbygids.3 opt/lcg/share/man/man3/dpns_getgrpbynam.3 opt/lcg/share/man/man3/dpns_getgrpmap.3 opt/lcg/share/man/man3/dpns_getidmap.3 opt/lcg/share/man/man3/dpns_getifcevers.3 opt/lcg/share/man/man3/dpns_getreplica.3 opt/lcg/share/man/man3/dpns_getreplicax.3 opt/lcg/share/man/man3/dpns_getusrbynam.3 opt/lcg/share/man/man3/dpns_getusrbyuid.3 opt/lcg/share/man/man3/dpns_getusrmap.3 opt/lcg/share/man/man3/dpns_lchown.3 opt/lcg/share/man/man3/dpns_listrep4gc.3 opt/lcg/share/man/man3/dpns_listreplica.3 opt/lcg/share/man/man3/dpns_listreplicax.3 opt/lcg/share/man/man3/dpns_listrepset.3 opt/lcg/share/man/man3/dpns_lstat.3 opt/lcg/share/man/man3/dpns_mkdir.3 opt/lcg/share/man/man3/dpns_modifygrpmap.3 opt/lcg/share/man/man3/dpns_modifyusrmap.3 opt/lcg/share/man/man3/dpns_modreplica.3 opt/lcg/share/man/man3/dpns_modreplicax.3 opt/lcg/share/man/man3/dpns_opendir.3 opt/lcg/share/man/man3/dpns_opendirxg.3 opt/lcg/share/man/man3/dpns_ping.3 opt/lcg/share/man/man3/dpns_readdir.3 opt/lcg/share/man/man3/dpns_readdirg.3 opt/lcg/share/man/man3/dpns_readdirx.3 opt/lcg/share/man/man3/dpns_readdirxp.3 opt/lcg/share/man/man3/dpns_readdirxr.3 opt/lcg/share/man/man3/dpns_readlink.3 opt/lcg/share/man/man3/dpns_registerfiles.3 opt/lcg/share/man/man3/dpns_rename.3 opt/lcg/share/man/man3/dpns_rewinddir.3 opt/lcg/share/man/man3/dpns_rmdir.3 opt/lcg/share/man/man3/dpns_rmgrpmap.3 opt/lcg/share/man/man3/dpns_rmusrmap.3 opt/lcg/share/man/man3/dpns_setacl.3 opt/lcg/share/man/man3/dpns_setatime.3 opt/lcg/share/man/man3/dpns_seterrbuf.3 opt/lcg/share/man/man3/dpns_setfsize.3 opt/lcg/share/man/man3/dpns_setfsizec.3 opt/lcg/share/man/man3/dpns_setptime.3 opt/lcg/share/man/man3/dpns_setratime.3 opt/lcg/share/man/man3/dpns_setrltime.3 opt/lcg/share/man/man3/dpns_setrstatus.3 opt/lcg/share/man/man3/dpns_setrtype.3 opt/lcg/share/man/man3/dpns_startsess.3 opt/lcg/share/man/man3/dpns_starttrans.3 opt/lcg/share/man/man3/dpns_stat.3 opt/lcg/share/man/man3/dpns_statg.3 opt/lcg/share/man/man3/dpns_statr.3 opt/lcg/share/man/man3/dpns_symlink.3 opt/lcg/share/man/man3/dpns_umask.3 opt/lcg/share/man/man3/dpns_undelete.3 opt/lcg/share/man/man3/dpns_unlink.3 opt/lcg/share/man/man3/dpns_utime.3 opt/lcg/share/man/man3/rfio_access.3 opt/lcg/share/man/man3/rfio_chmod.3 opt/lcg/share/man/man3/rfio_chown.3 opt/lcg/share/man/man3/rfio_close.3 opt/lcg/share/man/man3/rfio_closedir.3 opt/lcg/share/man/man3/rfio_fchmod.3 opt/lcg/share/man/man3/rfio_fclose.3 opt/lcg/share/man/man3/rfio_feof.3 opt/lcg/share/man/man3/rfio_ferror.3 opt/lcg/share/man/man3/rfio_fflush.3 opt/lcg/share/man/man3/rfio_fileno.3 opt/lcg/share/man/man3/rfio_fopen.3 opt/lcg/share/man/man3/rfio_fopen64.3 opt/lcg/share/man/man3/rfio_fread.3 opt/lcg/share/man/man3/rfio_fseek.3 opt/lcg/share/man/man3/rfio_fseeko64.3 opt/lcg/share/man/man3/rfio_fstat.3 opt/lcg/share/man/man3/rfio_fstat64.3 opt/lcg/share/man/man3/rfio_ftell.3 opt/lcg/share/man/man3/rfio_ftello64.3 opt/lcg/share/man/man3/rfio_fwrite.3 opt/lcg/share/man/man3/rfio_lockf.3 opt/lcg/share/man/man3/rfio_lockf64.3 opt/lcg/share/man/man3/rfio_lseek.3 opt/lcg/share/man/man3/rfio_lseek64.3 opt/lcg/share/man/man3/rfio_lstat.3 opt/lcg/share/man/man3/rfio_lstat64.3 opt/lcg/share/man/man3/rfio_mkdir.3 opt/lcg/share/man/man3/rfio_mstat.3 opt/lcg/share/man/man3/rfio_mstat64.3 opt/lcg/share/man/man3/rfio_msymlink.3 opt/lcg/share/man/man3/rfio_munlink.3 opt/lcg/share/man/man3/rfio_open.3 opt/lcg/share/man/man3/rfio_open64.3 opt/lcg/share/man/man3/rfio_opendir.3 opt/lcg/share/man/man3/rfio_pclose.3 opt/lcg/share/man/man3/rfio_perror.3 opt/lcg/share/man/man3/rfio_popen.3 opt/lcg/share/man/man3/rfio_pread.3 opt/lcg/share/man/man3/rfio_preseek.3 opt/lcg/share/man/man3/rfio_preseek64.3 opt/lcg/share/man/man3/rfio_pwrite.3 opt/lcg/share/man/man3/rfio_read.3 opt/lcg/share/man/man3/rfio_readdir.3 opt/lcg/share/man/man3/rfio_readlink.3 opt/lcg/share/man/man3/rfio_rename.3 opt/lcg/share/man/man3/rfio_rewinddir.3 opt/lcg/share/man/man3/rfio_rmdir.3 opt/lcg/share/man/man3/rfio_serror.3 opt/lcg/share/man/man3/rfio_setbufsize.3 opt/lcg/share/man/man3/rfio_stat.3 opt/lcg/share/man/man3/rfio_stat64.3 opt/lcg/share/man/man3/rfio_statfs.3 opt/lcg/share/man/man3/rfio_statfs64.3 opt/lcg/share/man/man3/rfio_symlink.3 opt/lcg/share/man/man3/rfio_unlink.3 opt/lcg/share/man/man3/rfio_write.3 opt/lcg/share/man/man3/rfioreadopt.3 opt/lcg/share/man/man3/rfiosetopt.3lcgdm-1.10.0/debian/templates/libdpm1.postinst0000755000175000017500000000015511344235114020576 0ustar ellertellert#!/bin/sh set -e if [ "$1" = "configure" ]; then [ -x "/sbin/ldconfig" ] && /sbin/ldconfig fi #DEBHELPER# lcgdm-1.10.0/debian/templates/liblcgdm1.install0000644000175000017500000000010011344235114020652 0ustar ellertellertopt/lcg/@lib@/libCsec_plugin_*.so.* opt/lcg/@lib@/liblcgdm.so.* lcgdm-1.10.0/debian/templates/liblfc1.install0000644000175000017500000000003111343757762020354 0ustar ellertellertopt/lcg/@lib@/liblfc.so.*lcgdm-1.10.0/debian/templates/liblcgdm-dev.install0000644000175000017500000000305211343757762021377 0ustar ellertellertopt/lcg/include/lcgdm/Castor_limits.h opt/lcg/include/lcgdm/Cgetopt.h opt/lcg/include/lcgdm/Cglobals.h opt/lcg/include/lcgdm/Cgrp.h opt/lcg/include/lcgdm/Cinit.h opt/lcg/include/lcgdm/Cmutex.h opt/lcg/include/lcgdm/Cnetdb.h opt/lcg/include/lcgdm/Cpool_api.h opt/lcg/include/lcgdm/Cpwd.h opt/lcg/include/lcgdm/Cregexp.h opt/lcg/include/lcgdm/Cregexp_magic.h opt/lcg/include/lcgdm/Csched_api.h opt/lcg/include/lcgdm/Csched_flags.h opt/lcg/include/lcgdm/Csec_api.h opt/lcg/include/lcgdm/Csec_common.h opt/lcg/include/lcgdm/Csec_constants.h opt/lcg/include/lcgdm/Csnprintf.h opt/lcg/include/lcgdm/Cthread_api.h opt/lcg/include/lcgdm/Cthread_flags.h opt/lcg/include/lcgdm/Cthread_typedef.h opt/lcg/include/lcgdm/log.h opt/lcg/include/lcgdm/marshall.h opt/lcg/include/lcgdm/net.h opt/lcg/include/lcgdm/osdep.h opt/lcg/include/lcgdm/serrno.h opt/lcg/include/lcgdm/socket_timeout.h opt/lcg/include/lcgdm/trace.h opt/lcg/include/lcgdm/u64subr.h opt/lcg/@lib@/libCsec_plugin_*.so opt/lcg/@lib@/liblcgdm.so opt/lcg/@lib@/liblcgdm.a opt/lcg/share/man/man4/Castor_limits.4 opt/lcg/share/man/man3/Cnetdb.3 opt/lcg/share/man/man3/Cthread.3 opt/lcg/share/man/man3/serrno.3 opt/lcg/share/man/man3/Cgetopt.3 opt/lcg/share/man/man3/Cglobals.3 opt/lcg/share/man/man3/Cgrp.3 opt/lcg/share/man/man3/Cmutex.3 opt/lcg/share/man/man3/Cpool.3 opt/lcg/share/man/man3/Cpwd.3 opt/lcg/share/man/man3/Csched.3 opt/lcg/share/man/man3/Csec_api.3 opt/lcg/share/man/man3/getconfent.3 opt/lcg/share/man/man3/log.3 opt/lcg/share/man/man3/netclose.3 opt/lcg/share/man/man3/netread.3 opt/lcg/share/man/man3/netwrite.3lcgdm-1.10.0/debian/templates/libdpm-perl.install0000644000175000017500000000006311343757762021254 0ustar ellertellertopt/lcg/@lib@/perl/dpm.so opt/lcg/@lib@/perl/dpm.pmlcgdm-1.10.0/debian/templates/liblfc-dev.install0000644000175000017500000000773511364244530021054 0ustar ellertellertopt/lcg/include/lfc/Castor_limits.h opt/lcg/include/lfc/Cnetdb.h opt/lcg/include/lfc/Cns_api.h opt/lcg/include/lfc/Cns_constants.h opt/lcg/include/lfc/Cns_struct.h opt/lcg/include/lfc/lfc_api.h opt/lcg/include/lfc/osdep.h opt/lcg/include/lfc/serrno.h ../../test/perl/lfc/UI_validation_tests.pl opt/lcg/share/doc/liblfc-dev/examples/perl-interface-validation.pl ../../test/python/lfc/UI_validation_tests.py opt/lcg/share/doc/liblfc-dev/examples/python-interface-validation.py opt/lcg/@lib@/liblfc.so opt/lcg/@lib@/liblfc.a opt/lcg/share/man/man3/lfc_aborttrans.3 opt/lcg/share/man/man3/lfc_access.3 opt/lcg/share/man/man3/lfc_accessr.3 opt/lcg/share/man/man3/lfc_addreplica.3 opt/lcg/share/man/man3/lfc_addreplicax.3 opt/lcg/share/man/man3/lfc_chdir.3 opt/lcg/share/man/man3/lfc_chmod.3 opt/lcg/share/man/man3/lfc_chown.3 opt/lcg/share/man/man3/lfc_closedir.3 opt/lcg/share/man/man3/lfc_creatg.3 opt/lcg/share/man/man3/lfc_delcomment.3 opt/lcg/share/man/man3/lfc_delete.3 opt/lcg/share/man/man3/lfc_delfilesbyguid.3 opt/lcg/share/man/man3/lfc_delfilesbyname.3 opt/lcg/share/man/man3/lfc_delfilesbypattern.3 opt/lcg/share/man/man3/lfc_delreplica.3 opt/lcg/share/man/man3/lfc_delreplicas.3 opt/lcg/share/man/man3/lfc_delreplicasbysfn.3 opt/lcg/share/man/man3/lfc_endsess.3 opt/lcg/share/man/man3/lfc_endtrans.3 opt/lcg/share/man/man3/lfc_entergrpmap.3 opt/lcg/share/man/man3/lfc_enterusrmap.3 opt/lcg/share/man/man3/lfc_getacl.3 opt/lcg/share/man/man3/lfc_getcomment.3 opt/lcg/share/man/man3/lfc_getcwd.3 opt/lcg/share/man/man3/lfc_getgrpbygid.3 opt/lcg/share/man/man3/lfc_getgrpbygids.3 opt/lcg/share/man/man3/lfc_getgrpbynam.3 opt/lcg/share/man/man3/lfc_getgrpmap.3 opt/lcg/share/man/man3/lfc_getidmap.3 opt/lcg/share/man/man3/lfc_getifcevers.3 opt/lcg/share/man/man3/lfc_getlinks.3 opt/lcg/share/man/man3/lfc_getreplica.3 opt/lcg/share/man/man3/lfc_getreplicas.3 opt/lcg/share/man/man3/lfc_getreplicasl.3 opt/lcg/share/man/man3/lfc_getreplicass.3 opt/lcg/share/man/man3/lfc_getreplicax.3 opt/lcg/share/man/man3/lfc_getusrbynam.3 opt/lcg/share/man/man3/lfc_getusrbyuid.3 opt/lcg/share/man/man3/lfc_getusrmap.3 opt/lcg/share/man/man3/lfc_lchown.3 opt/lcg/share/man/man3/lfc_listlinks.3 opt/lcg/share/man/man3/lfc_listrep4gc.3 opt/lcg/share/man/man3/lfc_listreplica.3 opt/lcg/share/man/man3/lfc_listreplicax.3 opt/lcg/share/man/man3/lfc_listrepset.3 opt/lcg/share/man/man3/lfc_lstat.3 opt/lcg/share/man/man3/lfc_mkdir.3 opt/lcg/share/man/man3/lfc_mkdirg.3 opt/lcg/share/man/man3/lfc_modifygrpmap.3 opt/lcg/share/man/man3/lfc_modifyusrmap.3 opt/lcg/share/man/man3/lfc_modreplica.3 opt/lcg/share/man/man3/lfc_modreplicax.3 opt/lcg/share/man/man3/lfc_opendirg.3 opt/lcg/share/man/man3/lfc_opendirxg.3 opt/lcg/share/man/man3/lfc_ping.3 opt/lcg/share/man/man3/lfc_readdir.3 opt/lcg/share/man/man3/lfc_readdirc.3 opt/lcg/share/man/man3/lfc_readdirg.3 opt/lcg/share/man/man3/lfc_readdirxc.3 opt/lcg/share/man/man3/lfc_readdirxp.3 opt/lcg/share/man/man3/lfc_readdirxr.3 opt/lcg/share/man/man3/lfc_readlink.3 opt/lcg/share/man/man3/lfc_registerfiles.3 opt/lcg/share/man/man3/lfc_rename.3 opt/lcg/share/man/man3/lfc_rewinddir.3 opt/lcg/share/man/man3/lfc_rmdir.3 opt/lcg/share/man/man3/lfc_rmgrpmap.3 opt/lcg/share/man/man3/lfc_rmusrmap.3 opt/lcg/share/man/man3/lfc_setacl.3 opt/lcg/share/man/man3/lfc_setatime.3 opt/lcg/share/man/man3/lfc_setcomment.3 opt/lcg/share/man/man3/lfc_seterrbuf.3 opt/lcg/share/man/man3/lfc_setfsize.3 opt/lcg/share/man/man3/lfc_setfsizec.3 opt/lcg/share/man/man3/lfc_setfsizeg.3 opt/lcg/share/man/man3/lfc_setptime.3 opt/lcg/share/man/man3/lfc_setratime.3 opt/lcg/share/man/man3/lfc_setrltime.3 opt/lcg/share/man/man3/lfc_setrstatus.3 opt/lcg/share/man/man3/lfc_setrtype.3 opt/lcg/share/man/man3/lfc_startsess.3 opt/lcg/share/man/man3/lfc_starttrans.3 opt/lcg/share/man/man3/lfc_stat.3 opt/lcg/share/man/man3/lfc_statg.3 opt/lcg/share/man/man3/lfc_statr.3 opt/lcg/share/man/man3/lfc_symlink.3 opt/lcg/share/man/man3/lfc_umask.3 opt/lcg/share/man/man3/lfc_undelete.3 opt/lcg/share/man/man3/lfc_unlink.3 opt/lcg/share/man/man3/lfc_utime.3 lcgdm-1.10.0/debian/templates/python-dpm.install0000644000175000017500000000057011343757762021147 0ustar ellertellertopt/lcg/@lib@/python@PYTHON.VERSION@/site-packages/_dpm.so opt/lcg/@lib@/python@PYTHON.VERSION@/site-packages/dpm.py opt/lcg/@lib@/python@PYTHON.VERSION@/site-packages/_dpm2.so opt/lcg/@lib@/python@PYTHON.VERSION@/site-packages/dpm2.py opt/lcg/bin/dpm-listspaces opt/lcg/share/man/man1/dpm-listspaces.1 opt/lcg/share/man/man3/dpm_python.3 opt/lcg/share/man/man3/dpm2_python.3 lcgdm-1.10.0/debian/templates/liblfc1.postinst0000755000175000017500000000015511344235114020562 0ustar ellertellert#!/bin/sh set -e if [ "$1" = "configure" ]; then [ -x "/sbin/ldconfig" ] && /sbin/ldconfig fi #DEBHELPER# lcgdm-1.10.0/debian/templates/liblfc-perl.install0000644000175000017500000000012611343757762021240 0ustar ellertellertopt/lcg/@lib@/perl/lfc.so opt/lcg/@lib@/perl/lfc.pm opt/lcg/share/man/man3/lfc_perl.3 lcgdm-1.10.0/debian/templates/lfc-client.install0000644000175000017500000000266711341455367021073 0ustar ellertellertopt/lcg/bin/lfc-chgrp opt/lcg/bin/lfc-chmod opt/lcg/bin/lfc-chown opt/lcg/bin/lfc-delcomment opt/lcg/bin/lfc-entergrpmap opt/lcg/bin/lfc-enterusrmap opt/lcg/bin/lfc-getacl opt/lcg/bin/lfc-listgrpmap opt/lcg/bin/lfc-listusrmap opt/lcg/bin/lfc-ln opt/lcg/bin/lfc-ls opt/lcg/bin/lfc-mkdir opt/lcg/bin/lfc-modifygrpmap opt/lcg/bin/lfc-modifyusrmap opt/lcg/bin/lfc-ping opt/lcg/bin/lfc-rename opt/lcg/bin/lfc-rm opt/lcg/bin/lfc-rmgrpmap opt/lcg/bin/lfc-rmusrmap opt/lcg/bin/lfc-setacl opt/lcg/bin/lfc-setcomment opt/lcg/share/man/man1/lfc-chgrp.1 opt/lcg/share/man/man1/lfc-chmod.1 opt/lcg/share/man/man1/lfc-chown.1 opt/lcg/share/man/man1/lfc-delcomment.1 opt/lcg/share/man/man1/lfc-entergrpmap.1 opt/lcg/share/man/man1/lfc-enterusrmap.1 opt/lcg/share/man/man1/lfc-getacl.1 opt/lcg/share/man/man1/lfc-listgrpmap.1 opt/lcg/share/man/man1/lfc-listusrmap.1 opt/lcg/share/man/man1/lfc-ln.1 opt/lcg/share/man/man1/lfc-ls.1 opt/lcg/share/man/man1/lfc-mkdir.1 opt/lcg/share/man/man1/lfc-modifygrpmap.1 opt/lcg/share/man/man1/lfc-modifyusrmap.1 opt/lcg/share/man/man1/lfc-ping.1 opt/lcg/share/man/man1/lfc-rename.1 opt/lcg/share/man/man1/lfc-rm.1 opt/lcg/share/man/man1/lfc-rmgrpmap.1 opt/lcg/share/man/man1/lfc-rmusrmap.1 opt/lcg/share/man/man1/lfc-setacl.1 opt/lcg/share/man/man1/lfc-setcomment.1 ../../doc/lfc/README opt/lcg/share/doc/lfc-client/README ../../doc/lfc/INSTALL-client opt/lcg/share/doc/lfc-client/INSTALL-client lcgdm-1.10.0/debian/templates/python-lfc.install0000644000175000017500000000105511343757762021132 0ustar ellertellertopt/lcg/@lib@/python@PYTHON.VERSION@/site-packages/_lfc.so opt/lcg/@lib@/python@PYTHON.VERSION@/site-packages/lfc.py opt/lcg/@lib@/python@PYTHON.VERSION@/site-packages/_lfcthr.so opt/lcg/@lib@/python@PYTHON.VERSION@/site-packages/lfcthr.py opt/lcg/@lib@/python@PYTHON.VERSION@/site-packages/_lfc2.so opt/lcg/@lib@/python@PYTHON.VERSION@/site-packages/lfc2.py opt/lcg/@lib@/python@PYTHON.VERSION@/site-packages/_lfc2thr.so opt/lcg/@lib@/python@PYTHON.VERSION@/site-packages/lfc2thr.py opt/lcg/share/man/man3/lfc_python.3 opt/lcg/share/man/man3/lfc2_python.3 lcgdm-1.10.0/debian/templates/dpm-client.install0000644000175000017500000000510211341455367021072 0ustar ellertellertopt/lcg/bin/dpm-addfs opt/lcg/bin/dpm-addpool opt/lcg/bin/dpm-drain opt/lcg/bin/dpm-getspacemd opt/lcg/bin/dpm-getspacetokens opt/lcg/bin/dpm-modifyfs opt/lcg/bin/dpm-modifypool opt/lcg/bin/dpm-ping opt/lcg/bin/dpm-qryconf opt/lcg/bin/dpm-register opt/lcg/bin/dpm-releasespace opt/lcg/bin/dpm-replicate opt/lcg/bin/dpm-reservespace opt/lcg/bin/dpm-rmfs opt/lcg/bin/dpm-rmpool opt/lcg/bin/dpm-updatespace opt/lcg/bin/dpns-chgrp opt/lcg/bin/dpns-chmod opt/lcg/bin/dpns-chown opt/lcg/bin/dpns-entergrpmap opt/lcg/bin/dpns-enterusrmap opt/lcg/bin/dpns-getacl opt/lcg/bin/dpns-listgrpmap opt/lcg/bin/dpns-listusrmap opt/lcg/bin/dpns-ln opt/lcg/bin/dpns-ls opt/lcg/bin/dpns-mkdir opt/lcg/bin/dpns-modifygrpmap opt/lcg/bin/dpns-modifyusrmap opt/lcg/bin/dpns-ping opt/lcg/bin/dpns-rename opt/lcg/bin/dpns-rm opt/lcg/bin/dpns-rmgrpmap opt/lcg/bin/dpns-rmusrmap opt/lcg/bin/dpns-setacl opt/lcg/bin/rfcat opt/lcg/bin/rfchmod opt/lcg/bin/rfcp opt/lcg/bin/rfdf opt/lcg/bin/rfdir opt/lcg/bin/rfmkdir opt/lcg/bin/rfrename opt/lcg/bin/rfrm opt/lcg/bin/rfstat opt/lcg/share/man/man1/dpm-addfs.1 opt/lcg/share/man/man1/dpm-addpool.1 opt/lcg/share/man/man1/dpm-drain.1 opt/lcg/share/man/man1/dpm-getspacemd.1 opt/lcg/share/man/man1/dpm-getspacetokens.1 opt/lcg/share/man/man1/dpm-modifyfs.1 opt/lcg/share/man/man1/dpm-modifypool.1 opt/lcg/share/man/man1/dpm-ping.1 opt/lcg/share/man/man1/dpm-qryconf.1 opt/lcg/share/man/man1/dpm-register.1 opt/lcg/share/man/man1/dpm-releasespace.1 opt/lcg/share/man/man1/dpm-replicate.1 opt/lcg/share/man/man1/dpm-reservespace.1 opt/lcg/share/man/man1/dpm-rmfs.1 opt/lcg/share/man/man1/dpm-rmpool.1 opt/lcg/share/man/man1/dpm-updatespace.1 opt/lcg/share/man/man1/dpns-chgrp.1 opt/lcg/share/man/man1/dpns-chmod.1 opt/lcg/share/man/man1/dpns-chown.1 opt/lcg/share/man/man1/dpns-entergrpmap.1 opt/lcg/share/man/man1/dpns-enterusrmap.1 opt/lcg/share/man/man1/dpns-getacl.1 opt/lcg/share/man/man1/dpns-listgrpmap.1 opt/lcg/share/man/man1/dpns-listusrmap.1 opt/lcg/share/man/man1/dpns-ln.1 opt/lcg/share/man/man1/dpns-ls.1 opt/lcg/share/man/man1/dpns-mkdir.1 opt/lcg/share/man/man1/dpns-modifygrpmap.1 opt/lcg/share/man/man1/dpns-modifyusrmap.1 opt/lcg/share/man/man1/dpns-ping.1 opt/lcg/share/man/man1/dpns-rename.1 opt/lcg/share/man/man1/dpns-rm.1 opt/lcg/share/man/man1/dpns-rmgrpmap.1 opt/lcg/share/man/man1/dpns-rmusrmap.1 opt/lcg/share/man/man1/dpns-setacl.1 opt/lcg/share/man/man1/rfcat.1 opt/lcg/share/man/man1/rfchmod.1 opt/lcg/share/man/man1/rfcp.1 opt/lcg/share/man/man1/rfdf.1 opt/lcg/share/man/man1/rfdir.1 opt/lcg/share/man/man1/rfmkdir.1 opt/lcg/share/man/man1/rfrename.1 opt/lcg/share/man/man1/rfrm.1 lcgdm-1.10.0/solaris/0000755000175000017500000000000013234072402013670 5ustar ellertellertlcgdm-1.10.0/solaris/depend.lcgdmcmn0000644000175000017500000000005111160153705016633 0ustar ellertellertP VOMS-api-cpp VOMS API (C++ libraries) lcgdm-1.10.0/solaris/prototype.rfioserver0000644000175000017500000000056711301004517020050 0ustar ellertellerti pkginfo=pkginfo.rfioserver i depend=depend.rfioserver d none bin 0755 root bin f none bin/rfiod 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/rfiod.1 0644 root bin d none etc 0755 root bin f none etc/rfiod.conf.templ 0644 root bin f none /etc/init.d/rfiod=share/DPM/rc.rfiod 0755 root bin lcgdm-1.10.0/solaris/prototype.lfcmys0000644000175000017500000000156411301004517017155 0ustar ellertellerti pkginfo=pkginfo.lfcmys i depend=depend.lfcmys d none bin 0755 root bin f none bin/lfcdaemon 0755 root bin f none bin/lfc-shutdown 0755 root bin f none bin/lfc-dli 0755 root bin f none bin/lfc-dli-client 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/lfcdaemon.1 0644 root bin f none share/man/man1/lfc-shutdown.1 0644 root bin f none share/man/man1/lfc-dli.1 0644 root bin f none share/man/man1/lfc-dli-client.1 0644 root bin d none etc 0755 root bin f none etc/NSCONFIG.templ 0600 root bin f none etc/lfcdaemon.conf.templ 0644 root bin f none etc/lfc-dli.conf.templ 0644 root bin f none /etc/init.d/lfcdaemon=share/LFC/rc.lfcdaemon 0755 root bin f none /etc/init.d/lfc-dli=share/LFC/rc.lfc-dli 0755 root bin d none share/LFC 0755 root bin f none share/LFC/create_lfc_tables_mysql.sql 0644 root bin lcgdm-1.10.0/solaris/depend.dpmmys0000644000175000017500000000021311137173440016362 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages P SUNWmysqlu mysql - MySQL Database Management System (usr component) lcgdm-1.10.0/solaris/depend.dpmora0000644000175000017500000000010411153232245016327 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages lcgdm-1.10.0/solaris/pkginfo.lcgdmcmn0000644000175000017500000000056011137173440017040 0ustar ellertellertPKG="LCG-DM-common" NAME="LCG Data Management common libraries and man pages" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="The lcg-dm-common package contains common libraries and man pages that are useful for the LCG Data Management components, the LFC (LCG File Catalog) and the DPM (Disk Pool Manager)" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/prototype.lfcifce20000644000175000017500000000134711301004517017334 0ustar ellertellerti pkginfo=pkginfo.lfcifce2 i depend=depend.lfcifce !pythondirname=python$PYTHON_VERSION d none lib 0755 root bin d none lib/perl 0755 root bin f none lib/perl/lfc.so 0755 root bin f none lib/perl/lfc.pm 0755 root bin d none lib/python 0755 root bin d none lib/$pythondirname 0755 root bin d none lib/$pythondirname/site-packages 0755 root bin f none lib/$pythondirname/site-packages/_lfc2.so 0755 root bin f none lib/$pythondirname/site-packages/lfc2.py 0755 root bin f none lib/$pythondirname/site-packages/_lfc2thr.so 0755 root bin f none lib/$pythondirname/site-packages/lfc2thr.py 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man3 0755 root bin f none share/man/man3/lfc2_python.3 0644 root bin lcgdm-1.10.0/solaris/prototype.dpmclient0000644000175000017500000002306511576042362017655 0ustar ellertellerti pkginfo=pkginfo.dpmclient i depend=depend.client !libname=libdpm.so.$VERSION d none bin 0755 root bin ! default 0755 root bin f none bin/dpm-addfs f none bin/dpm-addpool f none bin/dpm-drain f none bin/dpm-getspacemd f none bin/dpm-getspacetokens f none bin/dpm-modifyfs f none bin/dpm-modifypool f none bin/dpm-ping f none bin/dpm-qryconf f none bin/dpm-register f none bin/dpm-releasespace f none bin/dpm-replicate f none bin/dpm-reservespace f none bin/dpm-rmfs f none bin/dpm-rmpool f none bin/dpm-updatespace f none bin/dpns-chgrp f none bin/dpns-chmod f none bin/dpns-chown f none bin/dpns-entergrpmap f none bin/dpns-enterusrmap f none bin/dpns-getacl f none bin/dpns-listgrpmap f none bin/dpns-listusrmap f none bin/dpns-ln f none bin/dpns-ls f none bin/dpns-mkdir f none bin/dpns-modifygrpmap f none bin/dpns-modifyusrmap f none bin/dpns-ping f none bin/dpns-rename f none bin/dpns-rm f none bin/dpns-rmgrpmap f none bin/dpns-rmusrmap f none bin/dpns-setacl f none bin/rfcat f none bin/rfchmod f none bin/rfcp f none bin/rfdf f none bin/rfdir f none bin/rfmkdir f none bin/rfrename f none bin/rfrm f none bin/rfstat d none include 0755 root bin d none include/dpm 0755 root bin ! default 0644 root bin f none include/dpm/Castor_limits.h f none include/dpm/Cnetdb.h f none include/dpm/Cns_api.h f none include/dpm/Cns_constants.h f none include/dpm/Cns_struct.h f none include/dpm/dpm_api.h f none include/dpm/dpm_constants.h f none include/dpm/dpm_struct.h f none include/dpm/dpns_api.h f none include/dpm/osdep.h f none include/dpm/rfcntl.h f none include/dpm/rfio.h f none include/dpm/rfio_api.h f none include/dpm/rfio_constants.h f none include/dpm/rfio_errno.h f none include/dpm/serrno.h f none include/dpm/u64subr.h d none lib 0755 root bin f none lib/libdpm.a 0755 root bin s none lib/libdpm.so=$libname f none lib/$libname 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin ! default 0644 root bin f none share/man/man1/dpm-addfs.1 f none share/man/man1/dpm-addpool.1 f none share/man/man1/dpm-drain.1 f none share/man/man1/dpm-getspacemd.1 f none share/man/man1/dpm-getspacetokens.1 f none share/man/man1/dpm-modifyfs.1 f none share/man/man1/dpm-modifypool.1 f none share/man/man1/dpm-ping.1 f none share/man/man1/dpm-qryconf.1 f none share/man/man1/dpm-register.1 f none share/man/man1/dpm-releasespace.1 f none share/man/man1/dpm-replicate.1 f none share/man/man1/dpm-reservespace.1 f none share/man/man1/dpm-rmfs.1 f none share/man/man1/dpm-rmpool.1 f none share/man/man1/dpm-updatespace.1 f none share/man/man1/dpns-chgrp.1 f none share/man/man1/dpns-chmod.1 f none share/man/man1/dpns-chown.1 f none share/man/man1/dpns-entergrpmap.1 f none share/man/man1/dpns-enterusrmap.1 f none share/man/man1/dpns-getacl.1 f none share/man/man1/dpns-listgrpmap.1 f none share/man/man1/dpns-listusrmap.1 f none share/man/man1/dpns-ln.1 f none share/man/man1/dpns-ls.1 f none share/man/man1/dpns-mkdir.1 f none share/man/man1/dpns-modifygrpmap.1 f none share/man/man1/dpns-modifyusrmap.1 f none share/man/man1/dpns-ping.1 f none share/man/man1/dpns-rename.1 f none share/man/man1/dpns-rm.1 f none share/man/man1/dpns-rmgrpmap.1 f none share/man/man1/dpns-rmusrmap.1 f none share/man/man1/dpns-setacl.1 f none share/man/man1/rfcat.1 f none share/man/man1/rfchmod.1 f none share/man/man1/rfcp.1 f none share/man/man1/rfdir.1 f none share/man/man1/rfmkdir.1 f none share/man/man1/rfrename.1 f none share/man/man1/rfrm.1 f none share/man/man1/rfstat.1 d none share/man/man3 0755 root bin f none share/man/man3/dpm_abortfiles.3 f none share/man/man3/dpm_abortreq.3 f none share/man/man3/dpm_addfs.3 f none share/man/man3/dpm_addpool.3 f none share/man/man3/dpm_copy.3 f none share/man/man3/dpm_delreplica.3 f none share/man/man3/dpm_extendfilelife.3 f none share/man/man3/dpm_get.3 f none share/man/man3/dpm_getifcevers.3 f none share/man/man3/dpm_getpoolfs.3 f none share/man/man3/dpm_getpools.3 f none share/man/man3/dpm_getprotocols.3 f none share/man/man3/dpm_getreqid.3 f none share/man/man3/dpm_getreqsummary.3 f none share/man/man3/dpm_getspacemd.3 f none share/man/man3/dpm_getspacetoken.3 f none share/man/man3/dpm_getstatus_copyreq.3 f none share/man/man3/dpm_getstatus_getreq.3 f none share/man/man3/dpm_getstatus_putreq.3 f none share/man/man3/dpm_modifyfs.3 f none share/man/man3/dpm_modifypool.3 f none share/man/man3/dpm_ping.3 f none share/man/man3/dpm_put.3 f none share/man/man3/dpm_putdone.3 f none share/man/man3/dpm_releasespace.3 f none share/man/man3/dpm_relfiles.3 f none share/man/man3/dpm_reservespace.3 f none share/man/man3/dpm_rm.3 f none share/man/man3/dpm_rmfs.3 f none share/man/man3/dpm_rmpool.3 f none share/man/man3/dpm_seterrbuf.3 f none share/man/man3/dpm_updatespace.3 f none share/man/man3/dpns_aborttrans.3 f none share/man/man3/dpns_access.3 f none share/man/man3/dpns_accessr.3 f none share/man/man3/dpns_addreplica.3 f none share/man/man3/dpns_addreplicax.3 f none share/man/man3/dpns_chdir.3 f none share/man/man3/dpns_chmod.3 f none share/man/man3/dpns_chown.3 f none share/man/man3/dpns_closedir.3 f none share/man/man3/dpns_creat.3 f none share/man/man3/dpns_delete.3 f none share/man/man3/dpns_delreplica.3 f none share/man/man3/dpns_delreplicasbysfn.3 f none share/man/man3/dpns_endsess.3 f none share/man/man3/dpns_endtrans.3 f none share/man/man3/dpns_entergrpmap.3 f none share/man/man3/dpns_enterusrmap.3 f none share/man/man3/dpns_getacl.3 f none share/man/man3/dpns_getcwd.3 f none share/man/man3/dpns_getgrpbygid.3 f none share/man/man3/dpns_getgrpbygids.3 f none share/man/man3/dpns_getgrpbynam.3 f none share/man/man3/dpns_getgrpmap.3 f none share/man/man3/dpns_getidmap.3 f none share/man/man3/dpns_getifcevers.3 f none share/man/man3/dpns_getreplica.3 f none share/man/man3/dpns_getreplicax.3 f none share/man/man3/dpns_getusrbynam.3 f none share/man/man3/dpns_getusrbyuid.3 f none share/man/man3/dpns_getusrmap.3 f none share/man/man3/dpns_lchown.3 f none share/man/man3/dpns_listrep4gc.3 f none share/man/man3/dpns_listreplica.3 f none share/man/man3/dpns_listreplicax.3 f none share/man/man3/dpns_listrepset.3 f none share/man/man3/dpns_lstat.3 f none share/man/man3/dpns_mkdir.3 f none share/man/man3/dpns_modifygrpmap.3 f none share/man/man3/dpns_modifyusrmap.3 f none share/man/man3/dpns_modreplica.3 f none share/man/man3/dpns_modreplicax.3 f none share/man/man3/dpns_opendir.3 f none share/man/man3/dpns_opendirxg.3 f none share/man/man3/dpns_ping.3 f none share/man/man3/dpns_readdir.3 f none share/man/man3/dpns_readdirg.3 f none share/man/man3/dpns_readdirx.3 f none share/man/man3/dpns_readdirxp.3 f none share/man/man3/dpns_readdirxr.3 f none share/man/man3/dpns_readlink.3 f none share/man/man3/dpns_registerfiles.3 f none share/man/man3/dpns_rename.3 f none share/man/man3/dpns_rewinddir.3 f none share/man/man3/dpns_rmdir.3 f none share/man/man3/dpns_rmgrpmap.3 f none share/man/man3/dpns_rmusrmap.3 f none share/man/man3/dpns_setacl.3 f none share/man/man3/dpns_setatime.3 f none share/man/man3/dpns_seterrbuf.3 f none share/man/man3/dpns_setfsize.3 f none share/man/man3/dpns_setfsizec.3 f none share/man/man3/dpns_setptime.3 f none share/man/man3/dpns_setratime.3 f none share/man/man3/dpns_setrltime.3 f none share/man/man3/dpns_setrstatus.3 f none share/man/man3/dpns_setrtype.3 f none share/man/man3/dpns_startsess.3 f none share/man/man3/dpns_starttrans.3 f none share/man/man3/dpns_stat.3 f none share/man/man3/dpns_statg.3 f none share/man/man3/dpns_statr.3 f none share/man/man3/dpns_symlink.3 f none share/man/man3/dpns_umask.3 f none share/man/man3/dpns_undelete.3 f none share/man/man3/dpns_unlink.3 f none share/man/man3/dpns_utime.3 f none share/man/man3/rfio_access.3 f none share/man/man3/rfio_chmod.3 f none share/man/man3/rfio_chown.3 f none share/man/man3/rfio_close.3 f none share/man/man3/rfio_closedir.3 f none share/man/man3/rfio_fchmod.3 f none share/man/man3/rfio_fclose.3 f none share/man/man3/rfio_feof.3 f none share/man/man3/rfio_ferror.3 f none share/man/man3/rfio_fflush.3 f none share/man/man3/rfio_fileno.3 f none share/man/man3/rfio_fopen.3 f none share/man/man3/rfio_fopen64.3 f none share/man/man3/rfio_fread.3 f none share/man/man3/rfio_fseek.3 f none share/man/man3/rfio_fseeko64.3 f none share/man/man3/rfio_fstat.3 f none share/man/man3/rfio_fstat64.3 f none share/man/man3/rfio_ftell.3 f none share/man/man3/rfio_ftello64.3 f none share/man/man3/rfio_fwrite.3 f none share/man/man3/rfio_lockf.3 f none share/man/man3/rfio_lockf64.3 f none share/man/man3/rfio_lseek.3 f none share/man/man3/rfio_lseek64.3 f none share/man/man3/rfio_lstat.3 f none share/man/man3/rfio_lstat64.3 f none share/man/man3/rfio_mkdir.3 f none share/man/man3/rfio_mstat.3 f none share/man/man3/rfio_mstat64.3 f none share/man/man3/rfio_msymlink.3 f none share/man/man3/rfio_munlink.3 f none share/man/man3/rfio_open.3 f none share/man/man3/rfio_open64.3 f none share/man/man3/rfio_opendir.3 f none share/man/man3/rfio_pclose.3 f none share/man/man3/rfio_perror.3 f none share/man/man3/rfio_popen.3 f none share/man/man3/rfio_preseek.3 f none share/man/man3/rfio_preseek64.3 f none share/man/man3/rfio_rcp.3 f none share/man/man3/rfio_read.3 f none share/man/man3/rfio_readdir.3 f none share/man/man3/rfio_readlink.3 f none share/man/man3/rfio_rename.3 f none share/man/man3/rfio_rewinddir.3 f none share/man/man3/rfio_rmdir.3 f none share/man/man3/rfio_serror.3 f none share/man/man3/rfio_setbufsize.3 f none share/man/man3/rfio_stat.3 f none share/man/man3/rfio_stat64.3 f none share/man/man3/rfio_statfs.3 f none share/man/man3/rfio_statfs64.3 f none share/man/man3/rfio_symlink.3 f none share/man/man3/rfio_unlink.3 f none share/man/man3/rfio_write.3 f none share/man/man3/rfioreadopt.3 f none share/man/man3/rfiosetopt.3 lcgdm-1.10.0/solaris/depend.dpmdicompsql0000644000175000017500000000022611153232245017546 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages P SUNWpostgr-libs The shared libraries required for any PostgreSQL 8.1.11 clients lcgdm-1.10.0/solaris/pkginfo.rfioserver0000644000175000017500000000030011137173440017432 0ustar ellertellertPKG="DPM-rfio-server" NAME="DPM RFIO server" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="RFIO server for the Disk Pool Manager" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/pkginfo.dpmifce20000644000175000017500000000023411160153705016741 0ustar ellertellertPKG="DPM-interfaces2" NAME="new DPM Python interface" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/pkginfo.lfcmys0000644000175000017500000000033211137173440016546 0ustar ellertellertPKG="LFC-server-mysql" NAME="LFC Server for a MySQL database backend" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="LFC server with MySQL database backend" EMAIL="hep-service-lfc@cern.ch" lcgdm-1.10.0/solaris/pkginfo.dpnsmys0000644000175000017500000000031211137173440016744 0ustar ellertellertPKG="DPM-name-server-mysql" NAME="DPNS MySQL Server" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="DPNS server with MySQL database backend" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/pkginfo.lfcora0000644000175000017500000000033611153232245016520 0ustar ellertellertPKG="LFC-server-oracle" NAME="LFC Server for an Oracle database backend" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="LFC server with Oracle database backend" EMAIL="hep-service-lfc@cern.ch" lcgdm-1.10.0/solaris/prototype.dpmdicommys0000644000175000017500000000124411565174442020221 0ustar ellertellerti pkginfo=pkginfo.dpmdicommys i depend=depend.dpmdicommys d none bin 0755 root bin f none bin/dpm 0755 root bin f none bin/dpm-buildfsv 0755 root bin f none bin/dpm-shutdown 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/dpm.1 0644 root bin f none share/man/man1/dpm-buildfsv.1 0644 root bin f none share/man/man1/dpm-shutdown.1 0644 root bin d none etc 0755 root bin f none etc/DPMCONFIG.templ 0600 root bin f none etc/dpm.conf.templ 0644 root bin f none /etc/init.d/dpm=share/DPM/rc.dpm 0755 root bin d none share/DPM 0755 root bin f none share/DPM/create_dpm_tables_mysql.sql 0644 root bin lcgdm-1.10.0/solaris/prototype.lfcora0000644000175000017500000000156511301004517017127 0ustar ellertellerti pkginfo=pkginfo.lfcora i depend=depend.lfcora d none bin 0755 root bin f none bin/lfcdaemon 0755 root bin f none bin/lfc-shutdown 0755 root bin f none bin/lfc-dli 0755 root bin f none bin/lfc-dli-client 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/lfcdaemon.1 0644 root bin f none share/man/man1/lfc-shutdown.1 0644 root bin f none share/man/man1/lfc-dli.1 0644 root bin f none share/man/man1/lfc-dli-client.1 0644 root bin d none etc 0755 root bin f none etc/NSCONFIG.templ 0600 root bin f none etc/lfcdaemon.conf.templ 0644 root bin f none etc/lfc-dli.conf.templ 0644 root bin f none /etc/init.d/lfcdaemon=share/LFC/rc.lfcdaemon 0755 root bin f none /etc/init.d/lfc-dli=share/LFC/rc.lfc-dli 0755 root bin d none share/LFC 0755 root bin f none share/LFC/create_lfc_tables_oracle.sql 0644 root bin lcgdm-1.10.0/solaris/prototype.dpmdicompsql0000644000175000017500000000125111565174442020366 0ustar ellertellerti pkginfo=pkginfo.dpmdicompsql i depend=depend.dpmdicompsql d none bin 0755 root bin f none bin/dpm 0755 root bin f none bin/dpm-buildfsv 0755 root bin f none bin/dpm-shutdown 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/dpm.1 0644 root bin f none share/man/man1/dpm-buildfsv.1 0644 root bin f none share/man/man1/dpm-shutdown.1 0644 root bin d none etc 0755 root bin f none etc/DPMCONFIG.templ 0600 root bin f none etc/dpm.conf.templ 0644 root bin f none /etc/init.d/dpm=share/DPM/rc.dpm 0755 root bin d none share/DPM 0755 root bin f none share/DPM/create_dpm_tables_postgres.sql 0644 root bin lcgdm-1.10.0/solaris/pkginfo.copyora0000644000175000017500000000032511153232245016724 0ustar ellertellertPKG="DPM-copy-server-oracle" NAME="DPM COPY Oracle Server" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="DPM COPY server with Oracle database backend" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/depend.dpmdicommys0000644000175000017500000000021311153232245017373 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages P SUNWmysqlu mysql - MySQL Database Management System (usr component) lcgdm-1.10.0/solaris/prototype.dpnsora0000644000175000017500000000115111301004517017316 0ustar ellertellerti pkginfo=pkginfo.dpnsora i depend=depend.dpnsora d none bin 0755 root bin f none bin/dpnsdaemon 0755 root bin f none bin/dpns-shutdown 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/dpnsdaemon.1 0644 root bin f none share/man/man1/dpns-shutdown.1 0644 root bin d none etc 0755 root bin f none etc/NSCONFIG.templ 0600 root bin f none etc/dpnsdaemon.conf.templ 0644 root bin f none /etc/init.d/dpnsdaemon=share/DPM/rc.dpnsdaemon 0755 root bin d none share/DPM 0755 root bin f none share/DPM/create_dpns_tables_oracle.sql 0644 root bin lcgdm-1.10.0/solaris/prototype.lfcifce0000644000175000017500000000142011301004517017242 0ustar ellertellerti pkginfo=pkginfo.lfcifce i depend=depend.lfcifce !pythondirname=python$PYTHON_VERSION d none lib 0755 root bin d none lib/perl 0755 root bin f none lib/perl/lfc.so 0755 root bin f none lib/perl/lfc.pm 0755 root bin d none lib/python 0755 root bin d none lib/$pythondirname 0755 root bin d none lib/$pythondirname/site-packages 0755 root bin f none lib/$pythondirname/site-packages/_lfc.so 0755 root bin f none lib/$pythondirname/site-packages/lfc.py 0755 root bin f none lib/$pythondirname/site-packages/_lfcthr.so 0755 root bin f none lib/$pythondirname/site-packages/lfcthr.py 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man3 0755 root bin f none share/man/man3/lfc_perl.3 0644 root bin f none share/man/man3/lfc_python.3 0644 root bin lcgdm-1.10.0/solaris/pkginfo.dpmclient0000644000175000017500000000022511137173440017231 0ustar ellertellertPKG="DPM-client" NAME="DPM/DPNS APIs and CLIs" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/prototype.srmmys0000644000175000017500000000132711301004517017207 0ustar ellertellerti pkginfo=pkginfo.srmmys i depend=depend.srmmys d none bin 0755 root bin f none bin/srmv1 0755 root bin f none bin/srmv2 0755 root bin f none bin/srmv2.2 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/srmv1.1 0644 root bin f none share/man/man1/srmv2.1 0644 root bin f none share/man/man1/srmv2.2.1 0644 root bin d none etc 0755 root bin f none etc/srmv1.conf.templ 0644 root bin f none etc/srmv2.conf.templ 0644 root bin f none etc/srmv2.2.conf.templ 0644 root bin f none /etc/init.d/srmv1=share/DPM/rc.srmv1 0755 root bin f none /etc/init.d/srmv2=share/DPM/rc.srmv2 0755 root bin f none /etc/init.d/srmv2.2=share/DPM/rc.srmv2.2 0755 root bin lcgdm-1.10.0/solaris/depend.dicommys0000644000175000017500000000026011137173440016677 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages P SUNWmysqlu mysql - MySQL Database Management System (usr component) P DPM-client DPM/DPNS APIs and CLIs lcgdm-1.10.0/solaris/depend.lfcifce0000644000175000017500000000004011160153705016440 0ustar ellertellertP LFC-client LFC APIs and CLIs lcgdm-1.10.0/solaris/Makefile0000644000175000017500000003542311355042505015342 0ustar ellertellert# # Copyright (c) Members of the EGEE Collaboration. 2006-2009. # See http://public.eu-egee.org/partners/ for details on # the copyright holders. # For license conditions see the license file or # http://www.apache.org/licenses/LICENSE-2.0 # # Authors: # Akos Frohner # Jean-Philippe Baud # # Makefile to build all RPMs in one go. default: all SHELL = /bin/sh ifndef VERSION include ../VERSION endif ifndef RELEASE_SUFFIX RELEASE_SUFFIX=sol10-x86 endif ifeq ($(GLOBUS_LOCATION),) GLOBUS_LOCATION=$(shell awk '/^.define.*GlobusLocation/ { print $$3 }' ../config/site.def) endif ifndef ORACLE_INSTANTCLIENT_LOCATION ORACLE_INSTANTCLIENT_LOCATION=/usr endif ifndef ORACLE_INSTANTCLIENT_VERSION ORACLE_INSTANTCLIENT_VERSION=10.2.0.3 endif ORACLE_INSTANTCLIENT_LIBDIR=$(ORACLE_INSTANTCLIENT_LOCATION)/lib/oracle/$(ORACLE_INSTANTCLIENT_VERSION)/client/lib/ PYTHON_VERSION=$(shell python -c "import sys; print sys.version[:3]") all: lcg-dm-common LFC-mysql DPM-mysql DPM-dicom-mysql ifneq ($(PROC_INIT),) all: LFC-oracle DPM-oracle endif all: mkdir -p ../RPMS cp build-*/RPMS/*-sol10-x86 ../RPMS/ client: lcg-dm-common LFC-client DPM-client mkdir -p ../RPMS cp build-*/RPMS/*-sol10-x86 ../RPMS/ check-proc: source $(PROC_INIT); which proc SOURCE_DIR=LCG-DM-$(VERSION) SOURCE_TAR=$(SOURCE_DIR).tar.gz $(SOURCE_TAR): cd ..; \ rm -rf $(SOURCE_DIR); \ mkdir $(SOURCE_DIR); \ cp -rp Imakefile Makefile.ini Makefile.ini.Win32 README VERSION \ config imake test setosflags configure doc scripts \ h lib shlib common ns rfio dpm srmv1 srmv2 srmv2.2 security \ dli dicomcopy dpmcopy $(SOURCE_DIR); \ find $(SOURCE_DIR) -name .svn -exec rm -rf {} \;; \ gtar -czf $(SOURCE_TAR) $(SOURCE_DIR); \ rm -rf $(SOURCE_DIR) mv ../$(SOURCE_TAR) . source: $(SOURCE_TAR) build-pkg: source mkdir -p build-pkg mkdir -p build-pkg/BUILD mkdir -p build-pkg/RPMS mkdir -p build-pkg/SOURCES cp $(SOURCE_TAR) build-pkg/SOURCES ############################################################################### # common ############################################################################### lcg-dm-common: build-pkg cd build-pkg/BUILD; \ rm -rf $@-$(VERSION); \ gtar -xzf ../SOURCES/$(SOURCE_TAR); \ mv $(SOURCE_DIR) $@-$(VERSION) BUILD_ROOT=$(PWD)/build-pkg/BUILD/$@-$(VERSION)-root; \ LD_LIBRARY_PATH=$(GLOBUS_LOCATION)/lib:$(LD_LIBRARY_PATH); export LD_LIBRARY_PATH; \ (cd build-pkg/BUILD/$@-$(VERSION); \ ./configure --with-client-only dm CC=gcc MAKE=gmake ${EXTRA_CONFIGURE_OPTIONS}; \ gmake; \ gmake install prefix=$$BUILD_ROOT; \ gmake install.man prefix=$$BUILD_ROOT); \ pkgmk -o -b$$BUILD_ROOT -f prototype.lcgdmcmn -v $(VERSION) VERSION=$(VERSION) pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/LCG-DM-common-$(VERSION)-$(RELEASE_SUFFIX) LCG-DM-common ############################################################################### # LFC client ############################################################################### LFC-client: build-pkg cd build-pkg/BUILD; \ rm -rf $@-$(VERSION); \ gtar -xzf ../SOURCES/$(SOURCE_TAR); \ mv $(SOURCE_DIR) $@-$(VERSION) BUILD_ROOT=$(PWD)/build-pkg/BUILD/$@-$(VERSION)-root; \ LD_LIBRARY_PATH=$(GLOBUS_LOCATION)/lib:$(LD_LIBRARY_PATH); export LD_LIBRARY_PATH; \ (cd build-pkg/BUILD/$@-$(VERSION); \ ./configure --with-client-only lfc CC=gcc MAKE=gmake ${EXTRA_CONFIGURE_OPTIONS}; \ gmake; \ gmake install prefix=$$BUILD_ROOT; \ gmake install.man prefix=$$BUILD_ROOT); \ pkgmk -o -b$$BUILD_ROOT -f prototype.lfcclient -v $(VERSION) VERSION=$(VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.lfcifce -v $(VERSION) PYTHON_VERSION=$(PYTHON_VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.lfcifce2 -v $(VERSION) PYTHON_VERSION=$(PYTHON_VERSION) pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/LFC-client-$(VERSION)-$(RELEASE_SUFFIX) LFC-client pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/LFC-interfaces-$(VERSION)-$(RELEASE_SUFFIX) LFC-interfaces pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/LFC-interfaces2-$(VERSION)-$(RELEASE_SUFFIX) LFC-interfaces2 ############################################################################### # DPM client ############################################################################### DPM-client: build-pkg cd build-pkg/BUILD; \ rm -rf $@-$(VERSION); \ gtar -xzf ../SOURCES/$(SOURCE_TAR); \ mv $(SOURCE_DIR) $@-$(VERSION) BUILD_ROOT=$(PWD)/build-pkg/BUILD/$@-$(VERSION)-root; \ LD_LIBRARY_PATH=$(GLOBUS_LOCATION)/lib:$(LD_LIBRARY_PATH); export LD_LIBRARY_PATH; \ (cd build-pkg/BUILD/$@-$(VERSION); \ ./configure --with-client-only dpm CC=gcc MAKE=gmake ${EXTRA_CONFIGURE_OPTIONS}; \ gmake; \ gmake install prefix=$$BUILD_ROOT; \ gmake install.man prefix=$$BUILD_ROOT); \ pkgmk -o -b$$BUILD_ROOT -f prototype.dpmclient -v $(VERSION) VERSION=$(VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.dpmifce -v $(VERSION) PYTHON_VERSION=$(PYTHON_VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.dpmifce2 -v $(VERSION) PYTHON_VERSION=$(PYTHON_VERSION) pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-client-$(VERSION)-$(RELEASE_SUFFIX) DPM-client pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-interfaces-$(VERSION)-$(RELEASE_SUFFIX) DPM-interfaces pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-interfaces2-$(VERSION)-$(RELEASE_SUFFIX) DPM-interfaces2 ############################################################################### # LFC MySQL ############################################################################### LFC-mysql: build-pkg cd build-pkg/BUILD; \ rm -rf $@-$(VERSION); \ gtar -xzf ../SOURCES/$(SOURCE_TAR); \ mv $(SOURCE_DIR) $@-$(VERSION) BUILD_ROOT=$(PWD)/build-pkg/BUILD/$@-$(VERSION)-root; \ LD_LIBRARY_PATH=$(GLOBUS_LOCATION)/lib:$(LD_LIBRARY_PATH); export LD_LIBRARY_PATH; \ (cd build-pkg/BUILD/$@-$(VERSION); \ ./configure --with-mysql lfc CC=gcc MAKE=gmake ${EXTRA_CONFIGURE_OPTIONS}; \ gmake; \ gmake install prefix=$$BUILD_ROOT; \ gmake install.man prefix=$$BUILD_ROOT); \ pkgmk -o -b$$BUILD_ROOT -f prototype.lfcclient -v $(VERSION) VERSION=$(VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.lfcifce -v $(VERSION) PYTHON_VERSION=$(PYTHON_VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.lfcifce2 -v $(VERSION) PYTHON_VERSION=$(PYTHON_VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.lfcmys -v $(VERSION) VERSION=$(VERSION) pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/LFC-client-$(VERSION)-$(RELEASE_SUFFIX) LFC-client pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/LFC-interfaces-$(VERSION)-$(RELEASE_SUFFIX) LFC-interfaces pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/LFC-interfaces2-$(VERSION)-$(RELEASE_SUFFIX) LFC-interfaces2 pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/LFC-server-mysql-$(VERSION)-$(RELEASE_SUFFIX) LFC-server-mysql ############################################################################### # DPM MySQL ############################################################################### DPM-mysql: build-pkg cd build-pkg/BUILD; \ rm -rf $@-$(VERSION); \ gtar -xzf ../SOURCES/$(SOURCE_TAR); \ mv $(SOURCE_DIR) $@-$(VERSION) BUILD_ROOT=$(PWD)/build-pkg/BUILD/$@-$(VERSION)-root; \ LD_LIBRARY_PATH=$(GLOBUS_LOCATION)/lib:$(LD_LIBRARY_PATH); export LD_LIBRARY_PATH; \ (cd build-pkg/BUILD/$@-$(VERSION); \ ./configure --with-mysql dpm CC=gcc MAKE=gmake ${EXTRA_CONFIGURE_OPTIONS}; \ gmake; \ gmake install prefix=$$BUILD_ROOT; \ gmake install.man prefix=$$BUILD_ROOT); \ pkgmk -o -b$$BUILD_ROOT -f prototype.dpmclient -v $(VERSION) VERSION=$(VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.dpmifce -v $(VERSION) PYTHON_VERSION=$(PYTHON_VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.dpmifce2 -v $(VERSION) PYTHON_VERSION=$(PYTHON_VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.dpmmys -v $(VERSION) VERSION=$(VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.copymys -v $(VERSION) VERSION=$(VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.dpnsmys -v $(VERSION) VERSION=$(VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.srmmys -v $(VERSION) VERSION=$(VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.rfioserver -v $(VERSION) VERSION=$(VERSION) pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-client-$(VERSION)-$(RELEASE_SUFFIX) DPM-client pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-interfaces-$(VERSION)-$(RELEASE_SUFFIX) DPM-interfaces pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-interfaces2-$(VERSION)-$(RELEASE_SUFFIX) DPM-interfaces2 pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-server-mysql-$(VERSION)-$(RELEASE_SUFFIX) DPM-server-mysql pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-copy-server-mysql-$(VERSION)-$(RELEASE_SUFFIX) DPM-copy-server-mysql pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-name-server-mysql-$(VERSION)-$(RELEASE_SUFFIX) DPM-name-server-mysql pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-srm-server-mysql-$(VERSION)-$(RELEASE_SUFFIX) DPM-srm-server-mysql pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-rfio-server-$(VERSION)-$(RELEASE_SUFFIX) DPM-rfio-server ############################################################################### # DPM-DICOM MySQL ############################################################################### DPM-dicom-mysql: build-pkg cd build-pkg/BUILD; \ rm -rf $@-$(VERSION); \ gtar -xzf ../SOURCES/$(SOURCE_TAR); \ mv $(SOURCE_DIR) $@-$(VERSION) BUILD_ROOT=$(PWD)/build-pkg/BUILD/$@-$(VERSION)-root; \ LD_LIBRARY_PATH=$(GLOBUS_LOCATION)/lib:$(LD_LIBRARY_PATH); export LD_LIBRARY_PATH; \ (cd build-pkg/BUILD/$@-$(VERSION); \ ./configure --with-mysql --with-dicom dpm CC=gcc MAKE=gmake ${EXTRA_CONFIGURE_OPTIONS}; \ gmake; \ gmake install prefix=$$BUILD_ROOT; \ gmake install.man prefix=$$BUILD_ROOT); \ pkgmk -o -b$$BUILD_ROOT -f prototype.dpmdicommys -v $(VERSION) VERSION=$(VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.dicommys -v $(VERSION) VERSION=$(VERSION) pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-dicom-server-mysql-$(VERSION)-$(RELEASE_SUFFIX) DPM-dicom-server-mysql pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-dicom-copyd-mysql-$(VERSION)-$(RELEASE_SUFFIX) DPM-dicom-copyd-mysql ############################################################################### # LFC Oracle ############################################################################### LFC-oracle: build-pkg cd build-pkg/BUILD; \ rm -rf $@-$(VERSION); \ gtar -xzf ../SOURCES/$(SOURCE_TAR); \ mv $(SOURCE_DIR) $@-$(VERSION) BUILD_ROOT=$(PWD)/build-pkg/BUILD/$@-$(VERSION)-root; \ LD_LIBRARY_PATH=$(GLOBUS_LOCATION)/lib:$(ORACLE_INSTANTCLIENT_LIBDIR):$(LD_LIBRARY_PATH); export LD_LIBRARY_PATH; \ (cd build-pkg/BUILD/$@-$(VERSION); \ ./configure --with-oracle lfc CC=gcc MAKE=gmake ${EXTRA_CONFIGURE_OPTIONS}; \ gmake; \ gmake install prefix=$$BUILD_ROOT; \ gmake install.man prefix=$$BUILD_ROOT); \ pkgmk -o -b$$BUILD_ROOT -f prototype.lfcora -v $(VERSION) VERSION=$(VERSION) pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/LFC-server-oracle-$(VERSION)-$(RELEASE_SUFFIX) LFC-server-oracle ############################################################################### # DPM Oracle ############################################################################### DPM-oracle: build-pkg cd build-pkg/BUILD; \ rm -rf $@-$(VERSION); \ gtar -xzf ../SOURCES/$(SOURCE_TAR); \ mv $(SOURCE_DIR) $@-$(VERSION) BUILD_ROOT=$(PWD)/build-pkg/BUILD/$@-$(VERSION)-root; \ LD_LIBRARY_PATH=$(GLOBUS_LOCATION)/lib:$(ORACLE_INSTANTCLIENT_LIBDIR):$(LD_LIBRARY_PATH); export LD_LIBRARY_PATH; \ (cd build-pkg/BUILD/$@-$(VERSION); \ ./configure --with-oracle dpm CC=gcc MAKE=gmake ${EXTRA_CONFIGURE_OPTIONS}; \ gmake; \ gmake install prefix=$$BUILD_ROOT; \ gmake install.man prefix=$$BUILD_ROOT); \ pkgmk -o -b$$BUILD_ROOT -f prototype.dpmora -v $(VERSION) VERSION=$(VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.copyora -v $(VERSION) VERSION=$(VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.dpnsora -v $(VERSION) VERSION=$(VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.srmora -v $(VERSION) VERSION=$(VERSION) pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-server-oracle-$(VERSION)-$(RELEASE_SUFFIX) DPM-server-oracle pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-copy-server-oracle-$(VERSION)-$(RELEASE_SUFFIX) DPM-copy-server-oracle pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-name-server-oracle-$(VERSION)-$(RELEASE_SUFFIX) DPM-name-server-oracle pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-srm-server-oracle-$(VERSION)-$(RELEASE_SUFFIX) DPM-srm-server-oracle ############################################################################### # LFC PostgreSQL ############################################################################### LFC-postgres: build-pkg cd build-pkg/BUILD; \ rm -rf $@-$(VERSION); \ gtar -xzf ../SOURCES/$(SOURCE_TAR); \ mv $(SOURCE_DIR) $@-$(VERSION) BUILD_ROOT=$(PWD)/build-pkg/BUILD/$@-$(VERSION)-root; \ LD_LIBRARY_PATH=$(GLOBUS_LOCATION)/lib:$(LD_LIBRARY_PATH); export LD_LIBRARY_PATH; \ (cd build-pkg/BUILD/$@-$(VERSION); \ ./configure --with-postgres lfc CC=gcc MAKE=gmake ${EXTRA_CONFIGURE_OPTIONS}; \ gmake; \ gmake install prefix=$$BUILD_ROOT; \ gmake install.man prefix=$$BUILD_ROOT); \ pkgmk -o -b$$BUILD_ROOT -f prototype.lfcpsql -v $(VERSION) VERSION=$(VERSION) pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/LFC-server-postgres-$(VERSION)-$(RELEASE_SUFFIX) LFC-server-postgres ############################################################################### # DPM PostgreSQL ############################################################################### DPM-postgres: build-pkg cd build-pkg/BUILD; \ rm -rf $@-$(VERSION); \ gtar -xzf ../SOURCES/$(SOURCE_TAR); \ mv $(SOURCE_DIR) $@-$(VERSION) BUILD_ROOT=$(PWD)/build-pkg/BUILD/$@-$(VERSION)-root; \ LD_LIBRARY_PATH=$(GLOBUS_LOCATION)/lib:$(LD_LIBRARY_PATH); export LD_LIBRARY_PATH; \ (cd build-pkg/BUILD/$@-$(VERSION); \ ./configure --with-postgres dpm CC=gcc MAKE=gmake ${EXTRA_CONFIGURE_OPTIONS}; \ gmake; \ gmake install prefix=$$BUILD_ROOT; \ gmake install.man prefix=$$BUILD_ROOT); \ pkgmk -o -b$$BUILD_ROOT -f prototype.dpmpsql -v $(VERSION) VERSION=$(VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.copypsql -v $(VERSION) VERSION=$(VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.dpnspsql -v $(VERSION) VERSION=$(VERSION); \ pkgmk -o -b$$BUILD_ROOT -f prototype.srmpsql -v $(VERSION) VERSION=$(VERSION) pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-server-postgres-$(VERSION)-$(RELEASE_SUFFIX) DPM-server-postgres pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-copy-server-postgres-$(VERSION)-$(RELEASE_SUFFIX) DPM-copy-server-postgres pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-name-server-postgres-$(VERSION)-$(RELEASE_SUFFIX) DPM-name-server-postgres pkgtrans -o -s /var/spool/pkg $(PWD)/build-pkg/RPMS/DPM-srm-server-postgres-$(VERSION)-$(RELEASE_SUFFIX) DPM-srm-server-postgres clean: -rm -rf ../RPMS build-pkg $(SOURCE_TAR) lcgdm-1.10.0/solaris/prototype.dicompsql0000644000175000017500000000076111301004517017651 0ustar ellertellerti pkginfo=pkginfo.dicompsql i depend=depend.dicompsql d none bin 0755 root bin f none bin/dicomcopyd 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/dicomcopyd.1 0644 root bin d none etc 0755 root bin f none etc/dicomcopyd.conf.templ 0644 root bin f none /etc/init.d/dicomcopyd=share/DPM/rc.dicomcopyd 0755 root bin d none share/DPM 0755 root bin f none share/DPM/create_dicomcopy_tables_postgres.sql 0644 root bin lcgdm-1.10.0/solaris/pkginfo.dpmdicommys0000644000175000017500000000036711153232245017603 0ustar ellertellertPKG="DPM-dicom-server-mysql" NAME="DPM MySQL Server" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="DPM server with MySQL database backend and support for additional storage back-ends." EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/pkginfo.dicommys0000644000175000017500000000033611137173440017101 0ustar ellertellertPKG="DPM-dicom-copyd-mysql" NAME="DPM DICOM Copy MySQL Server" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="DPM DICOM Copy server with MySQL database backend" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/prototype.dpmifce0000644000175000017500000000114011301004517017255 0ustar ellertellerti pkginfo=pkginfo.dpmifce i depend=depend.dpmifce !pythondirname=python$PYTHON_VERSION d none lib 0755 root bin d none lib/perl 0755 root bin f none lib/perl/dpm.so 0755 root bin f none lib/perl/dpm.pm 0755 root bin d none lib/python 0755 root bin d none lib/$pythondirname 0755 root bin d none lib/$pythondirname/site-packages 0755 root bin f none lib/$pythondirname/site-packages/_dpm.so 0755 root bin f none lib/$pythondirname/site-packages/dpm.py 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man3 0755 root bin f none share/man/man3/dpm_python.3 0644 root bin lcgdm-1.10.0/solaris/pkginfo.dpmmys0000644000175000017500000000030311137173440016560 0ustar ellertellertPKG="DPM-server-mysql" NAME="DPM MySQL Server" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="DPM server with MySQL database backend" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/pkginfo.lfcclient0000644000175000017500000000022011137173440017210 0ustar ellertellertPKG="LFC-client" NAME="LFC APIs and CLIs" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" EMAIL="hep-service-lfc@cern.ch" lcgdm-1.10.0/solaris/depend.dpnsmys0000644000175000017500000000021311137173440016546 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages P SUNWmysqlu mysql - MySQL Database Management System (usr component) lcgdm-1.10.0/solaris/pkginfo.srmmys0000644000175000017500000000032111137173440016601 0ustar ellertellertPKG="DPM-srm-server-mysql" NAME="DPM SRM MySQL Servers" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="DPM SRM servers with MySQL database backend" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/pkginfo.lfcifce0000644000175000017500000000024111160153705016641 0ustar ellertellertPKG="LFC-interfaces" NAME="LFC Perl and Python interfaces" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" EMAIL="hep-service-lfc@cern.ch" lcgdm-1.10.0/solaris/depend.lfcora0000644000175000017500000000010411153232245016313 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages lcgdm-1.10.0/solaris/pkginfo.dpmifce0000644000175000017500000000024111160153705016655 0ustar ellertellertPKG="DPM-interfaces" NAME="DPM Perl and Python interfaces" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/prototype.dpnspsql0000644000175000017500000000115511301004517017520 0ustar ellertellerti pkginfo=pkginfo.dpnspsql i depend=depend.dpnspsql d none bin 0755 root bin f none bin/dpnsdaemon 0755 root bin f none bin/dpns-shutdown 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/dpnsdaemon.1 0644 root bin f none share/man/man1/dpns-shutdown.1 0644 root bin d none etc 0755 root bin f none etc/NSCONFIG.templ 0600 root bin f none etc/dpnsdaemon.conf.templ 0644 root bin f none /etc/init.d/dpnsdaemon=share/DPM/rc.dpnsdaemon 0755 root bin d none share/DPM 0755 root bin f none share/DPM/create_dpns_tables_postgres.sql 0644 root bin lcgdm-1.10.0/solaris/prototype.srmora0000644000175000017500000000132711301004517017160 0ustar ellertellerti pkginfo=pkginfo.srmora i depend=depend.srmora d none bin 0755 root bin f none bin/srmv1 0755 root bin f none bin/srmv2 0755 root bin f none bin/srmv2.2 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/srmv1.1 0644 root bin f none share/man/man1/srmv2.1 0644 root bin f none share/man/man1/srmv2.2.1 0644 root bin d none etc 0755 root bin f none etc/srmv1.conf.templ 0644 root bin f none etc/srmv2.conf.templ 0644 root bin f none etc/srmv2.2.conf.templ 0644 root bin f none /etc/init.d/srmv1=share/DPM/rc.srmv1 0755 root bin f none /etc/init.d/srmv2=share/DPM/rc.srmv2 0755 root bin f none /etc/init.d/srmv2.2=share/DPM/rc.srmv2.2 0755 root bin lcgdm-1.10.0/solaris/depend.client0000644000175000017500000000010411137173440016326 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages lcgdm-1.10.0/solaris/pkginfo.copymys0000644000175000017500000000032211137173440016753 0ustar ellertellertPKG="DPM-copy-server-mysql" NAME="DPM COPY MySQL Server" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="DPM COPY server with MySQL database backend" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/prototype.lfcpsql0000644000175000017500000000157111301004517017322 0ustar ellertellerti pkginfo=pkginfo.lfcpsql i depend=depend.lfcpsql d none bin 0755 root bin f none bin/lfcdaemon 0755 root bin f none bin/lfc-shutdown 0755 root bin f none bin/lfc-dli 0755 root bin f none bin/lfc-dli-client 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/lfcdaemon.1 0644 root bin f none share/man/man1/lfc-shutdown.1 0644 root bin f none share/man/man1/lfc-dli.1 0644 root bin f none share/man/man1/lfc-dli-client.1 0644 root bin d none etc 0755 root bin f none etc/NSCONFIG.templ 0600 root bin f none etc/lfcdaemon.conf.templ 0644 root bin f none etc/lfc-dli.conf.templ 0644 root bin f none /etc/init.d/lfcdaemon=share/LFC/rc.lfcdaemon 0755 root bin f none /etc/init.d/lfc-dli=share/LFC/rc.lfc-dli 0755 root bin d none share/LFC 0755 root bin f none share/LFC/create_lfc_tables_postgres.sql 0644 root bin lcgdm-1.10.0/solaris/prototype.dpmora0000644000175000017500000000123311565174442017154 0ustar ellertellerti pkginfo=pkginfo.dpmora i depend=depend.dpmora d none bin 0755 root bin f none bin/dpm 0755 root bin f none bin/dpm-buildfsv 0755 root bin f none bin/dpm-shutdown 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/dpm.1 0644 root bin f none share/man/man1/dpm-buildfsv.1 0644 root bin f none share/man/man1/dpm-shutdown.1 0644 root bin d none etc 0755 root bin f none etc/DPMCONFIG.templ 0600 root bin f none etc/dpm.conf.templ 0644 root bin f none /etc/init.d/dpm=share/DPM/rc.dpm 0755 root bin d none share/DPM 0755 root bin f none share/DPM/create_dpm_tables_oracle.sql 0644 root bin lcgdm-1.10.0/solaris/depend.copyora0000644000175000017500000000027311153232245016530 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages P DPM-client DPM/DPNS APIs and CLIs P CGSI-gSOAP27-voms GSI plugin for gSOAP 2.7 (shared libraries with VOMS support) lcgdm-1.10.0/solaris/depend.copypsql0000644000175000017500000000041511137173440016727 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages P SUNWpostgr-libs The shared libraries required for any PostgreSQL 8.1.11 clients P DPM-client DPM/DPNS APIs and CLIs P CGSI-gSOAP27-voms GSI plugin for gSOAP 2.7 (shared libraries with VOMS support) lcgdm-1.10.0/solaris/depend.dicompsql0000644000175000017500000000027311137173440017052 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages P SUNWpostgr-libs The shared libraries required for any PostgreSQL 8.1.11 clients P DPM-client DPM/DPNS APIs and CLIs lcgdm-1.10.0/solaris/pkginfo.lfcpsql0000644000175000017500000000034711137173440016723 0ustar ellertellertPKG="LFC-server-postgres" NAME="LFC Server for a PostgreSQL database backend" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="LFC server with PostgreSQL database backend" EMAIL="hep-service-lfc@cern.ch" lcgdm-1.10.0/solaris/depend.dpnspsql0000644000175000017500000000022611137173440016721 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages P SUNWpostgr-libs The shared libraries required for any PostgreSQL 8.1.11 clients lcgdm-1.10.0/solaris/prototype.lcgdmcmn0000644000175000017500000000455211577637636017501 0ustar ellertellerti pkginfo=pkginfo.lcgdmcmn i depend=depend.lcgdmcmn !gsiplugin=libCsec_plugin_GSI.so.$VERSION !gsipluginthr=libCsec_plugin_GSI_thread.so.$VERSION !idplugin=libCsec_plugin_ID.so.$VERSION !libname=liblcgdm.so.$VERSION d none lib 0755 root bin s none lib/libCsec_plugin_GSI.so=$gsiplugin f none lib/$gsiplugin 0755 root bin s none lib/libCsec_plugin_GSI_thread.so=$gsipluginthr f none lib/$gsipluginthr 0755 root bin s none lib/libCsec_plugin_ID.so=$idplugin f none lib/$idplugin 0755 root bin f none lib/liblcgdm.a 0755 root bin s none lib/liblcgdm.so=$libname f none lib/$libname 0755 root bin d none include 0755 root bin d none include/lcgdm 0755 root bin ! default 0644 root bin f none include/lcgdm/Castor_limits.h f none include/lcgdm/Cgetopt.h f none include/lcgdm/Cglobals.h f none include/lcgdm/Cgrp.h f none include/lcgdm/Cinit.h f none include/lcgdm/Clogit.h f none include/lcgdm/Cmutex.h f none include/lcgdm/Cnetdb.h f none include/lcgdm/Cpool_api.h f none include/lcgdm/Cpwd.h f none include/lcgdm/Cregexp.h f none include/lcgdm/Cregexp_magic.h f none include/lcgdm/Csched_api.h f none include/lcgdm/Csched_flags.h f none include/lcgdm/Csec_api.h f none include/lcgdm/Csec_common.h f none include/lcgdm/Csec_constants.h f none include/lcgdm/Csnprintf.h f none include/lcgdm/Cthread_api.h f none include/lcgdm/Cthread_flags.h f none include/lcgdm/Cthread_typedef.h f none include/lcgdm/log.h f none include/lcgdm/marshall.h f none include/lcgdm/net.h f none include/lcgdm/osdep.h f none include/lcgdm/serrno.h f none include/lcgdm/socket_timeout.h f none include/lcgdm/trace.h f none include/lcgdm/u64subr.h d none share 0755 root bin d none share/man 0755 root bin d none share/man/man3 0755 root bin ! default 0644 root bin f none share/man/man3/Cgetopt.3 f none share/man/man3/Cglobals.3 f none share/man/man3/Cgrp.3 f none share/man/man3/Cinitlog.3 f none share/man/man3/Clogit.3 f none share/man/man3/Cmutex.3 f none share/man/man3/Cnetdb.3 f none share/man/man3/Cpool.3 f none share/man/man3/Cpwd.3 f none share/man/man3/Csched.3 f none share/man/man3/Csec_api.3 f none share/man/man3/Cthread.3 f none share/man/man3/Cvlogit.3 f none share/man/man3/getconfent.3 f none share/man/man3/log.3 f none share/man/man3/netclose.3 f none share/man/man3/netread.3 f none share/man/man3/netwrite.3 f none share/man/man3/serrno.3 d none share/man/man4 0755 root bin f none share/man/man4/Castor_limits.4 lcgdm-1.10.0/solaris/pkginfo.dpmdicompsql0000644000175000017500000000040411153232245017742 0ustar ellertellertPKG="DPM-dicom-server-postgres" NAME="DPM PostgreSQL Server" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="DPM server with PostgreSQL database backend and support for additional storage back-ends." EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/pkginfo.dicompsql0000644000175000017500000000035311137173440017247 0ustar ellertellertPKG="DPM-dicom-copyd-postgres" NAME="DPM DICOM Copy PostgreSQL Server" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="DPM DICOM Copy server with PostgreSQL database backend" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/prototype.dicommys0000644000175000017500000000075411301004517017504 0ustar ellertellerti pkginfo=pkginfo.dicommys i depend=depend.dicommys d none bin 0755 root bin f none bin/dicomcopyd 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/dicomcopyd.1 0644 root bin d none etc 0755 root bin f none etc/dicomcopyd.conf.templ 0644 root bin f none /etc/init.d/dicomcopyd=share/DPM/rc.dicomcopyd 0755 root bin d none share/DPM 0755 root bin f none share/DPM/create_dicomcopy_tables_mysql.sql 0644 root bin lcgdm-1.10.0/solaris/prototype.srmpsql0000644000175000017500000000133111301004517017351 0ustar ellertellerti pkginfo=pkginfo.srmpsql i depend=depend.srmpsql d none bin 0755 root bin f none bin/srmv1 0755 root bin f none bin/srmv2 0755 root bin f none bin/srmv2.2 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/srmv1.1 0644 root bin f none share/man/man1/srmv2.1 0644 root bin f none share/man/man1/srmv2.2.1 0644 root bin d none etc 0755 root bin f none etc/srmv1.conf.templ 0644 root bin f none etc/srmv2.conf.templ 0644 root bin f none etc/srmv2.2.conf.templ 0644 root bin f none /etc/init.d/srmv1=share/DPM/rc.srmv1 0755 root bin f none /etc/init.d/srmv2=share/DPM/rc.srmv2 0755 root bin f none /etc/init.d/srmv2.2=share/DPM/rc.srmv2.2 0755 root bin lcgdm-1.10.0/solaris/prototype.lfcclient0000644000175000017500000001251011364244530017626 0ustar ellertellerti pkginfo=pkginfo.lfcclient i depend=depend.client !libname=liblfc.so.$VERSION d none bin 0755 root bin ! default 0755 root bin f none bin/lfc-chgrp f none bin/lfc-chmod f none bin/lfc-chown f none bin/lfc-delcomment f none bin/lfc-entergrpmap f none bin/lfc-enterusrmap f none bin/lfc-getacl f none bin/lfc-listgrpmap f none bin/lfc-listusrmap f none bin/lfc-ln f none bin/lfc-ls f none bin/lfc-mkdir f none bin/lfc-modifygrpmap f none bin/lfc-modifyusrmap f none bin/lfc-ping f none bin/lfc-rename f none bin/lfc-rm f none bin/lfc-rmgrpmap f none bin/lfc-rmusrmap f none bin/lfc-setacl f none bin/lfc-setcomment d none include 0755 root bin d none include/lfc 0755 root bin ! default 0644 root bin f none include/lfc/Castor_limits.h f none include/lfc/Cnetdb.h f none include/lfc/Cns_api.h f none include/lfc/Cns_constants.h f none include/lfc/Cns_struct.h f none include/lfc/lfc_api.h f none include/lfc/osdep.h f none include/lfc/serrno.h f none include/lfc/u64subr.h d none lib 0755 root bin f none lib/liblfc.a 0755 root bin s none lib/liblfc.so=$libname f none lib/$libname 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin ! default 0644 root bin f none share/man/man1/lfc-chgrp.1 f none share/man/man1/lfc-chmod.1 f none share/man/man1/lfc-chown.1 f none share/man/man1/lfc-delcomment.1 f none share/man/man1/lfc-entergrpmap.1 f none share/man/man1/lfc-enterusrmap.1 f none share/man/man1/lfc-getacl.1 f none share/man/man1/lfc-listgrpmap.1 f none share/man/man1/lfc-listusrmap.1 f none share/man/man1/lfc-ln.1 f none share/man/man1/lfc-ls.1 f none share/man/man1/lfc-mkdir.1 f none share/man/man1/lfc-modifygrpmap.1 f none share/man/man1/lfc-modifyusrmap.1 f none share/man/man1/lfc-ping.1 f none share/man/man1/lfc-rename.1 f none share/man/man1/lfc-rm.1 f none share/man/man1/lfc-rmgrpmap.1 f none share/man/man1/lfc-rmusrmap.1 f none share/man/man1/lfc-setacl.1 f none share/man/man1/lfc-setcomment.1 d none share/man/man3 0755 root bin f none share/man/man3/lfc_aborttrans.3 f none share/man/man3/lfc_access.3 f none share/man/man3/lfc_accessr.3 f none share/man/man3/lfc_addreplica.3 f none share/man/man3/lfc_addreplicax.3 f none share/man/man3/lfc_chdir.3 f none share/man/man3/lfc_chmod.3 f none share/man/man3/lfc_chown.3 f none share/man/man3/lfc_closedir.3 f none share/man/man3/lfc_creatg.3 f none share/man/man3/lfc_delcomment.3 f none share/man/man3/lfc_delete.3 f none share/man/man3/lfc_delfilesbyguid.3 f none share/man/man3/lfc_delfilesbyname.3 f none share/man/man3/lfc_delfilesbypattern.3 f none share/man/man3/lfc_delreplica.3 f none share/man/man3/lfc_delreplicas.3 f none share/man/man3/lfc_delreplicasbysfn.3 f none share/man/man3/lfc_endsess.3 f none share/man/man3/lfc_endtrans.3 f none share/man/man3/lfc_entergrpmap.3 f none share/man/man3/lfc_enterusrmap.3 f none share/man/man3/lfc_getacl.3 f none share/man/man3/lfc_getcomment.3 f none share/man/man3/lfc_getcwd.3 f none share/man/man3/lfc_getgrpbygid.3 f none share/man/man3/lfc_getgrpbygids.3 f none share/man/man3/lfc_getgrpbynam.3 f none share/man/man3/lfc_getgrpmap.3 f none share/man/man3/lfc_getidmap.3 f none share/man/man3/lfc_getifcevers.3 f none share/man/man3/lfc_getlinks.3 f none share/man/man3/lfc_getreplica.3 f none share/man/man3/lfc_getreplicas.3 f none share/man/man3/lfc_getreplicasl.3 f none share/man/man3/lfc_getreplicass.3 f none share/man/man3/lfc_getreplicax.3 f none share/man/man3/lfc_getusrbynam.3 f none share/man/man3/lfc_getusrbyuid.3 f none share/man/man3/lfc_getusrmap.3 f none share/man/man3/lfc_lchown.3 f none share/man/man3/lfc_listlinks.3 f none share/man/man3/lfc_listrep4gc.3 f none share/man/man3/lfc_listreplica.3 f none share/man/man3/lfc_listreplicax.3 f none share/man/man3/lfc_listrepset.3 f none share/man/man3/lfc_lstat.3 f none share/man/man3/lfc_mkdir.3 f none share/man/man3/lfc_mkdirg.3 f none share/man/man3/lfc_modifygrpmap.3 f none share/man/man3/lfc_modifyusrmap.3 f none share/man/man3/lfc_modreplica.3 f none share/man/man3/lfc_modreplicax.3 f none share/man/man3/lfc_opendirg.3 f none share/man/man3/lfc_opendirxg.3 f none share/man/man3/lfc_ping.3 f none share/man/man3/lfc_readdir.3 f none share/man/man3/lfc_readdirc.3 f none share/man/man3/lfc_readdirg.3 f none share/man/man3/lfc_readdirxc.3 f none share/man/man3/lfc_readdirxp.3 f none share/man/man3/lfc_readdirxr.3 f none share/man/man3/lfc_readlink.3 f none share/man/man3/lfc_registerfiles.3 f none share/man/man3/lfc_rename.3 f none share/man/man3/lfc_rewinddir.3 f none share/man/man3/lfc_rmdir.3 f none share/man/man3/lfc_rmgrpmap.3 f none share/man/man3/lfc_rmusrmap.3 f none share/man/man3/lfc_setacl.3 f none share/man/man3/lfc_setatime.3 f none share/man/man3/lfc_setcomment.3 f none share/man/man3/lfc_seterrbuf.3 f none share/man/man3/lfc_setfsize.3 f none share/man/man3/lfc_setfsizec.3 f none share/man/man3/lfc_setfsizeg.3 f none share/man/man3/lfc_setptime.3 f none share/man/man3/lfc_setratime.3 f none share/man/man3/lfc_setrltime.3 f none share/man/man3/lfc_setrstatus.3 f none share/man/man3/lfc_setrtype.3 f none share/man/man3/lfc_startsess.3 f none share/man/man3/lfc_starttrans.3 f none share/man/man3/lfc_stat.3 f none share/man/man3/lfc_statg.3 f none share/man/man3/lfc_statr.3 f none share/man/man3/lfc_symlink.3 f none share/man/man3/lfc_umask.3 f none share/man/man3/lfc_undelete.3 f none share/man/man3/lfc_unlink.3 f none share/man/man3/lfc_utime.3 lcgdm-1.10.0/solaris/prototype.dpmpsql0000644000175000017500000000123711565174442017356 0ustar ellertellerti pkginfo=pkginfo.dpmpsql i depend=depend.dpmpsql d none bin 0755 root bin f none bin/dpm 0755 root bin f none bin/dpm-buildfsv 0755 root bin f none bin/dpm-shutdown 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/dpm.1 0644 root bin f none share/man/man1/dpm-buildfsv.1 0644 root bin f none share/man/man1/dpm-shutdown.1 0644 root bin d none etc 0755 root bin f none etc/DPMCONFIG.templ 0600 root bin f none etc/dpm.conf.templ 0644 root bin f none /etc/init.d/dpm=share/DPM/rc.dpm 0755 root bin d none share/DPM 0755 root bin f none share/DPM/create_dpm_tables_postgres.sql 0644 root bin lcgdm-1.10.0/solaris/depend.lfcpsql0000644000175000017500000000022611137173440016521 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages P SUNWpostgr-libs The shared libraries required for any PostgreSQL 8.1.11 clients lcgdm-1.10.0/solaris/prototype.copymys0000644000175000017500000000060011301004517017351 0ustar ellertellerti pkginfo=pkginfo.copymys i depend=depend.copymys d none bin 0755 root bin f none bin/dpmcopyd 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/dpmcopyd.1 0644 root bin d none etc 0755 root bin f none etc/dpmcopyd.conf.templ 0644 root bin f none /etc/init.d/dpmcopyd=share/DPM/rc.dpmcopyd 0755 root bin lcgdm-1.10.0/solaris/pkginfo.copypsql0000644000175000017500000000033711137173440017130 0ustar ellertellertPKG="DPM-copy-server-postgres" NAME="DPM COPY PostgreSQL Server" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="DPM COPY server with PostgreSQL database backend" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/pkginfo.srmora0000644000175000017500000000032411153232245016552 0ustar ellertellertPKG="DPM-srm-server-oracle" NAME="DPM SRM Oracle Servers" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="DPM SRM servers with Oracle database backend" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/depend.rfioserver0000644000175000017500000000014711137173440017245 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages P DPM-client DPM/DPNS APIs and CLIs lcgdm-1.10.0/solaris/depend.copymys0000644000175000017500000000040211137173440016554 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages P SUNWmysqlu mysql - MySQL Database Management System (usr component) P DPM-client DPM/DPNS APIs and CLIs P CGSI-gSOAP27-voms GSI plugin for gSOAP 2.7 (shared libraries with VOMS support) lcgdm-1.10.0/solaris/depend.srmpsql0000644000175000017500000000041511137173440016556 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages P SUNWpostgr-libs The shared libraries required for any PostgreSQL 8.1.11 clients P DPM-client DPM/DPNS APIs and CLIs P CGSI-gSOAP27-voms GSI plugin for gSOAP 2.7 (shared libraries with VOMS support) lcgdm-1.10.0/solaris/depend.lfcmys0000644000175000017500000000021311137173440016346 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages P SUNWmysqlu mysql - MySQL Database Management System (usr component) lcgdm-1.10.0/solaris/pkginfo.dpnsora0000644000175000017500000000031511153232245016715 0ustar ellertellertPKG="DPM-name-server-oracle" NAME="DPNS Oracle Server" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="DPNS server with Oracle database backend" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/prototype.dpmmys0000644000175000017500000000123211565174442017202 0ustar ellertellerti pkginfo=pkginfo.dpmmys i depend=depend.dpmmys d none bin 0755 root bin f none bin/dpm 0755 root bin f none bin/dpm-buildfsv 0755 root bin f none bin/dpm-shutdown 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/dpm.1 0644 root bin f none share/man/man1/dpm-buildfsv.1 0644 root bin f none share/man/man1/dpm-shutdown.1 0644 root bin d none etc 0755 root bin f none etc/DPMCONFIG.templ 0600 root bin f none etc/dpm.conf.templ 0644 root bin f none /etc/init.d/dpm=share/DPM/rc.dpm 0755 root bin d none share/DPM 0755 root bin f none share/DPM/create_dpm_tables_mysql.sql 0644 root bin lcgdm-1.10.0/solaris/depend.srmmys0000644000175000017500000000040211137173440016403 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages P SUNWmysqlu mysql - MySQL Database Management System (usr component) P DPM-client DPM/DPNS APIs and CLIs P CGSI-gSOAP27-voms GSI plugin for gSOAP 2.7 (shared libraries with VOMS support) lcgdm-1.10.0/solaris/prototype.dpmifce20000644000175000017500000000077411301004517017353 0ustar ellertellerti pkginfo=pkginfo.dpmifce2 i depend=depend.dpmifce !pythondirname=python$PYTHON_VERSION d none lib 0755 root bin d none lib/python 0755 root bin d none lib/$pythondirname 0755 root bin d none lib/$pythondirname/site-packages 0755 root bin f none lib/$pythondirname/site-packages/_dpm2.so 0755 root bin f none lib/$pythondirname/site-packages/dpm2.py 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man3 0755 root bin f none share/man/man3/dpm2_python.3 0644 root bin lcgdm-1.10.0/solaris/pkginfo.srmpsql0000644000175000017500000000033611137173440016756 0ustar ellertellertPKG="DPM-srm-server-postgres" NAME="DPM SRM PostgreSQL Servers" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="DPM SRM servers with PostgreSQL database backend" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/pkginfo.dpmpsql0000644000175000017500000000032011137173440016726 0ustar ellertellertPKG="DPM-server-postgres" NAME="DPM PostgreSQL Server" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="DPM server with PostgreSQL database backend" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/prototype.copyora0000644000175000017500000000060011301004517017322 0ustar ellertellerti pkginfo=pkginfo.copyora i depend=depend.copyora d none bin 0755 root bin f none bin/dpmcopyd 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/dpmcopyd.1 0644 root bin d none etc 0755 root bin f none etc/dpmcopyd.conf.templ 0644 root bin f none /etc/init.d/dpmcopyd=share/DPM/rc.dpmcopyd 0755 root bin lcgdm-1.10.0/solaris/pkginfo.lfcifce20000644000175000017500000000023411160153705016725 0ustar ellertellertPKG="LFC-interfaces2" NAME="new LFC Python interface" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" EMAIL="hep-service-lfc@cern.ch" lcgdm-1.10.0/solaris/depend.dpmpsql0000644000175000017500000000022611137173440016535 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages P SUNWpostgr-libs The shared libraries required for any PostgreSQL 8.1.11 clients lcgdm-1.10.0/solaris/prototype.copypsql0000644000175000017500000000060211301004517017522 0ustar ellertellerti pkginfo=pkginfo.copypsql i depend=depend.copypsql d none bin 0755 root bin f none bin/dpmcopyd 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/dpmcopyd.1 0644 root bin d none etc 0755 root bin f none etc/dpmcopyd.conf.templ 0644 root bin f none /etc/init.d/dpmcopyd=share/DPM/rc.dpmcopyd 0755 root bin lcgdm-1.10.0/solaris/depend.dpnsora0000644000175000017500000000010411153232245016513 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages lcgdm-1.10.0/solaris/depend.dpmifce0000644000175000017500000000004511160153705016461 0ustar ellertellertP DPM-client DPM/DPNS APIs and CLIs lcgdm-1.10.0/solaris/depend.srmora0000644000175000017500000000027311153232245016357 0ustar ellertellertP LCG-DM-common LCG Data Management common libraries and man pages P DPM-client DPM/DPNS APIs and CLIs P CGSI-gSOAP27-voms GSI plugin for gSOAP 2.7 (shared libraries with VOMS support) lcgdm-1.10.0/solaris/pkginfo.dpmora0000644000175000017500000000030611153232245016531 0ustar ellertellertPKG="DPM-server-oracle" NAME="DPM Oracle Server" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="DPM server with Oracle database backend" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/pkginfo.dpnspsql0000644000175000017500000000032711137173440017121 0ustar ellertellertPKG="DPM-name-server-postgres" NAME="DPNS PostgreSQL Server" ARCH="i386" VERSION="x.x.x" CATEGORY="application" BASEDIR="/opt/lcg" DESC="DPNS server with PostgreSQL database backend" EMAIL="hep-service-dpm@cern.ch" lcgdm-1.10.0/solaris/prototype.dpnsmys0000644000175000017500000000115011301004517017344 0ustar ellertellerti pkginfo=pkginfo.dpnsmys i depend=depend.dpnsmys d none bin 0755 root bin f none bin/dpnsdaemon 0755 root bin f none bin/dpns-shutdown 0755 root bin d none share 0755 root bin d none share/man 0755 root bin d none share/man/man1 0755 root bin f none share/man/man1/dpnsdaemon.1 0644 root bin f none share/man/man1/dpns-shutdown.1 0644 root bin d none etc 0755 root bin f none etc/NSCONFIG.templ 0600 root bin f none etc/dpnsdaemon.conf.templ 0644 root bin f none /etc/init.d/dpnsdaemon=share/DPM/rc.dpnsdaemon 0755 root bin d none share/DPM 0755 root bin f none share/DPM/create_dpns_tables_mysql.sql 0644 root bin lcgdm-1.10.0/rfio/0000755000175000017500000000000013234072400013151 5ustar ellertellertlcgdm-1.10.0/rfio/switch_req.c0000644000175000017500000001600011336205452015470 0ustar ellertellert/* * $Id: switch_req.c 3172 2010-02-15 08:51:54Z baud $ */ /* * Copyright (C) 1990-2010 by CERN/IT/PDP/DM * All rights reserved * * This is a file of functions that merge some code common * to rfio_fcalls.c and xyopen.c, xyclose.c, xywrite.c and xyread.c * */ #define DEBUG 0 /* Debugging flag */ #define RFIO_KERNEL 1 /* KERNEL part of the programs */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: switch_req.c,v $ $Revision: 3172 $ $Date: 2010-02-15 09:51:54 +0100 (Mon, 15 Feb 2010) $ CERN/IT/PDP/DM Felix Hassine"; #endif #include "rfio.h" /* Remote file I/O */ #include "osdep.h" #include /* Genralized error logger */ int DLL_DECL switch_open(access, lun, filename, filen, lrecl,append,trunc,mod) int *access ; LONG *lun ; char *filename ; int *filen ; LONG *lrecl ; LONG *append ; LONG *trunc ; int mod ; { int status; switch ((int)*access) { case FFFACC_S: if (mod == LLTM) log(LOG_INFO, "rxyopen(%s) SEQUENTIAL\n",filename); else TRACE(2, "rfio", "rfio_xyopen(%s) SEQUENTIAL (local)",filename); #if defined(sun) || defined(sgi) || defined(hpux) || defined(_AIX) || ( defined(__osf__) && defined(__alpha) ) || defined(linux) || defined(_WIN32) || defined(__Lynx__) || defined( __APPLE__) status=usf_open(lun, filename, append,trunc); #else (void) fopn_us_(lun, filename, filen, append, &status); #endif break; case FFFACC_D: if (mod == LLTM) log(LOG_INFO, "rxyopen(%s) DIRECT\n",filename); else { TRACE(2, "rfio", "rfio_xyopen(%s) DIRECT (local)",filename); } #if defined(sun) || defined(sgi) || defined(hpux) || defined(_AIX) || ( defined(__osf__) && defined(__alpha) ) || defined(linux) || defined(_WIN32) || defined(__Lynx__) || defined( __APPLE__) status=udf_open(lun, filename, lrecl,trunc); #else (void) fopn_ud_(lun, filename, filen, lrecl, &status); #endif break; default: if (mod == LLTM) log(LOG_ERR, "rxyopen(%s) invalid access type: %d\n",filename, *access); else { TRACE(2, "rfio", "rfio_xyopen(%d) invalid access type: %d\n",lun, *access); } status = SEBADFOPT; } return (status); } int DLL_DECL switch_write(access,lun,ptr,nwrit,nrec,mod) int access ; LONG *lun ; char *ptr ; int *nwrit ; int *nrec ; int mod ; { int status; switch (access) { case FFFACC_S: if (mod == LLTM) log(LOG_DEBUG, "rxywrit(%d) SEQUENTIAL\n",*lun); else { TRACE(2, "rfio", "rfio_xywrit(%d) SEQUENTIAL",*lun); } #if defined(sun) || defined(sgi) || defined(hpux) || defined(_AIX) || ( defined(__osf__) && defined(__alpha) ) || defined(linux) || defined(_WIN32) || defined(__Lynx__) || defined( __APPLE__) status=usf_write(lun, ptr, nwrit); #else (void) fwr_us_(lun, ptr, nwrit, &status); #endif break; case FFFACC_D: if (mod == LLTM) log(LOG_DEBUG, "rxywrit(%d) DIRECT\n",*lun); else TRACE(2, "rfio", "rfio_xywrit(%d) DIRECT",*lun); #if defined(sun) || defined(sgi) || defined(hpux) || defined(_AIX) || ( defined(__osf__) && defined(__alpha) ) || defined(linux) || defined(_WIN32) || defined(__Lynx__) || defined( __APPLE__) status=udf_write(lun, ptr, nrec, nwrit); #else (void) fwr_ud_(lun, ptr, nrec, nwrit, &status); #endif break; default: if (mod == LLTM) log(LOG_ERR, "rxyopen(%d) invalid access type: %d\n",*lun, access); else TRACE(2, "rfio", "rfio_xywrite(%d) invalid access type:%d",*lun, access); status = SEBADFOPT; } return (status); } int DLL_DECL switch_read(access,ptlun,buffer1,nwant,nrec,readopt,ngot,mod) int access ; int *ptlun ; char *buffer1; int *nwant ; int *nrec ; int readopt ; int *ngot ; int mod ; { int status; if (readopt == FFREAD_C) { if (mod == LLTM) log(LOG_DEBUG, "rxyread(%d) SPECIAL\n",*ptlun); else { TRACE(2, "rfio", "rfio_xyread(%d) SPECIAL",*ptlun); } #if defined(sun) || defined(sgi) || defined(hpux) || defined(_AIX) || ( defined(__osf__) && defined(__alpha) ) || defined(linux) || defined(_WIN32) || defined(__Lynx__) || defined( __APPLE__) (void) uf_cread(ptlun, buffer1, nrec, nwant, ngot, &status); #else (void) frdc_(ptlun, buffer1, nwant, ngot, &status); #endif } else { switch (access) { case FFFACC_S: if (mod == LLTM) log(LOG_DEBUG, "rxyread(%d) SEQUENTIAL\n",*ptlun); else TRACE(2, "rfio", "rfio_xyread(%d) SEQUENTIAL",*ptlun); #if defined(sun) || defined(sgi) || defined(hpux) || defined(_AIX) || ( defined(__osf__) && defined(__alpha) ) || defined(linux) || defined(_WIN32) || defined(__Lynx__) || defined( __APPLE__) status=usf_read(ptlun, buffer1, nwant); #else (void) frd_us_(ptlun, buffer1, nwant, &status); #endif *ngot = *nwant; break; case FFFACC_D: if (mod == LLTM) log(LOG_DEBUG, "rxyread(%d) DIRECT\n",*ptlun); else TRACE(2, "rfio", "rfio_xyread(%d) DIRECT",*ptlun); #if defined(sun) || defined(sgi) || defined(hpux) || defined(_AIX) || ( defined(__osf__) && defined(__alpha) ) || defined(linux) || defined(_WIN32) || defined(__Lynx__) || defined( __APPLE__) status =udf_read(ptlun, buffer1, nrec, nwant); #else (void) frd_ud_(ptlun, buffer1, nrec, nwant, &status); #endif *ngot = *nwant; break; default: if (mod == LLTM) log(LOG_ERR, "rxyread(%d) invalid access type: %d\n",*ptlun, access); else TRACE(2, "rfio", "rfio_xyread(%d) invalid access type: %d",*ptlun, access); *ngot = 0; status = SEBADFOPT; } } return (status); } int DLL_DECL switch_close(lun) int *lun; { int irc; #if defined(sun) || defined(sgi) || defined(hpux) || defined(_AIX) || ( defined(__osf__) && defined(__alpha) ) || defined(linux) || defined(_WIN32) || defined(__Lynx__) || defined( __APPLE__) irc=uf_close(lun); #else (void) fcls_f_ (lun , &irc) ; #endif return(irc); } lcgdm-1.10.0/rfio/preseek.c0000644000175000017500000001321511544122040014753 0ustar ellertellert/* * $Id: preseek.c 4218 2011-03-28 15:07:12Z baud $ */ /* * Copyright (C) 1990-2011 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: preseek.c,v $ $Revision: 4218 $ $Date: 2011-03-28 17:07:12 +0200 (Mon, 28 Mar 2011) $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy"; #endif /* not lint */ /* preseek.c Remote File I/O - preseeking. */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #ifdef linux #include #endif #include "rfio.h" #include "rfio_rfilefdt.h" #include /* malloc prototype */ #ifndef min #define min(a,b) (((a)<(b)) ? (a):(b)) #endif /* * Remote file seek */ int DLL_DECL rfio_preseek(s,iov,iovnb) int s ; int iovnb ; struct iovec *iov ; { int s_index; char * p ; /* Pointer to buffer */ int i ; /* Loop index */ int temp = 0 ; /* Temporary buffer exists ? */ char *trp= NULL ; /* Pointer to temporary buffer */ char rfio_buf[BUFSIZ]; INIT_TRACE("RFIO_TRACE") ; TRACE(1,"rfio","rfio_preseek(%d, %x, %d)",s,iov,iovnb) ; /* * The file is local. * Nothing has to be done. */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1 ) { END_TRACE() ; return 0 ; } /* * Checking magic number */ if ( rfilefdt[s_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(s_index); (void) close(s); END_TRACE(); return -1 ; } /* * Nothing specified. */ if ( iovnb == 0 ) { END_TRACE() ; return 0 ; } for(i= 0; imode64) { struct iovec64 *iov64 ; int status ; if ((iov64 = malloc (iovnb * sizeof(struct iovec64))) == NULL) return (-1) ; for(i= 0; ireadissued || rfilefdt[s_index]->preseek) && rfilefdt[s_index]->lseekhow == -1 ) { rfilefdt[s_index]->lseekhow= SEEK_SET ; rfilefdt[s_index]->lseekoff= rfilefdt[s_index]->offset ; } /* * Resetting flags. * preseek() is forbidden when RFIO aren't buffered. */ rfilefdt[s_index]->eof= 0 ; rfilefdt[s_index]->preseek= 0 ; rfilefdt[s_index]->nbrecord= 0 ; rfilefdt[s_index]->readissued= 0 ; if ( rfilefdt[s_index]->_iobuf.base ) { rfilefdt[s_index]->_iobuf.count= 0 ; rfilefdt[s_index]->_iobuf.ptr= iodata(rfilefdt[s_index]) ; } else { errno= EINVAL ; END_TRACE() ; return -1 ; } /* * Is rfio_buf large enough to contain the request ? * If not a temporary buffer is allocated. * THe request is then sent. */ if ( (BUFSIZ-RQSTSIZE)/(2*LONGSIZE) < iovnb ) { temp= 1 ; if ((trp= (char *)malloc(RQSTSIZE+2*LONGSIZE*iovnb)) == NULL) return -1 ; } else { trp= rfio_buf ; } p= trp ; marshall_WORD(p,RFIO_MAGIC) ; marshall_WORD(p,RQST_PRESEEK) ; marshall_LONG(p,rfilefdt[s_index]->_iobuf.dsize) ; marshall_LONG(p,iovnb) ; p= trp + RQSTSIZE ; for(i= 0; i_iobuf.hsize + rfilefdt[s_index]->_iobuf.dsize ; TRACE(2, "rfio", "rfio_preseek: reading %d bytes",msgsiz) ; if (netread_timeout(s,rfilefdt[s_index]->_iobuf.base,msgsiz,RFIO_CTRL_TIMEOUT) != msgsiz) { TRACE(2,"rfio","rfio_preseek: read(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } p= rfilefdt[s_index]->_iobuf.base ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p,rcode) ; unmarshall_LONG(p,msgsiz) ; switch(req) { case RQST_FIRSTSEEK: rfio_errno = rcode ; TRACE(1,"rfio","rfio_preseek: status %d, rcode %d",status,rcode) ; if ( status == -1 ) { END_TRACE() ; return -1 ; } rfilefdt[s_index]->preseek= ( status == iovnb ) ? 2 : 1 ; rfilefdt[s_index]->nbrecord= status ; rfilefdt[s_index]->_iobuf.ptr= iodata(rfilefdt[s_index]) ; rfilefdt[s_index]->_iobuf.count= 0 ; END_TRACE() ; return 0 ; case RQST_PRESEEK: case RQST_LASTSEEK: case RQST_READAHEAD: break ; default: TRACE(1,"rfio","rfio_preseek(): Bad control word received") ; serrno= SEINTERNAL ; END_TRACE() ; return -1 ; } } } /* * FORTRAN bindings. */ #if defined(_AIX) int DLL_DECL presee(sptr,iov,iovnbptr) #else int DLL_DECL presee_(sptr,iov,iovnbptr) #endif /* AIX */ int * sptr ; struct iovec * iov ; int * iovnbptr ; { int status ; status= rfio_preseek(*sptr,iov,*iovnbptr) ; return status ; } lcgdm-1.10.0/rfio/rfio_calls.c0000644000175000017500000051551512416767760015473 0ustar ellertellert/* * Copyright (C) 1990-2011 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rfio_calls.c,v $ $Revision: 11099 $ $Date: 2014-10-13 17:29:52 +0200 (Mon, 13 Oct 2014) $ CERN/IT/PDP/DM Frederic Hemmer"; #endif /* not lint */ /* * Remote file I/O flags and declarations. */ #define DEBUG 0 #define RFIO_KERNEL 1 #include #include #include #include #include #if defined(_WIN32) #include "syslog.h" #else #include #include /* System logger */ #include #endif #if defined(_AIX) || defined(hpux) || defined(SOLARIS) || defined(linux) #include #endif #include "rfio.h" #include "rfio_server.h" #include "rfcntl.h" #include "log.h" #include "u64subr.h" #include "Castor_limits.h" #include "Cnetdb.h" #include "net.h" #include "serrno.h" #if defined(_AIX) #include #endif #include #if !defined(_WIN32) #include #if ((defined(IRIX5) || defined(IRIX6)) && ! (defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN) && defined(PDP_ENDIAN))) #ifdef LITTLE_ENDIAN #undef LITTLE_ENDIAN #endif #define LITTLE_ENDIAN 1234 #ifdef BIG_ENDIAN #undef BIG_ENDIAN #endif #define BIG_ENDIAN 4321 #ifdef PDP_ENDIAN #undef PDP_ENDIAN #endif #define PDP_ENDIAN 3412 #endif #include #else #include #endif #include #ifdef linux #include #endif #include #if (defined(IRIX5) || defined(IRIX6)) extern struct group *getgrent(void); #endif /* For real time stuff under Digital Unix V4 */ #ifdef RFIODaemonRealTime #ifdef DUXV4 #include #endif #endif /* For multithreading stuff, only tested under Linux at present */ static int daemonv3_rdmt, daemonv3_wrmt; #include #include "Csemaphore.h" /* If daemonv3_rdmt is true, reading from disk will be multithreaded The circular buffer will have in this case daemonv3_rdmt_nbuf buffers of size daemonv3_rdmt_bufsize. See defaults in rfio_server.h */ static int daemonv3_rdmt_nbuf, daemonv3_rdmt_bufsize; /* If daemonv3_wrmt is true, reading from disk will be multithreaded The circular buffer will have in this case daemonv3_wrmt_nbuf buffers of size daemonv3_wrmt_bufsize. See defaults in rfio_server.h */ static int daemonv3_wrmt_nbuf, daemonv3_wrmt_bufsize; /* The circular buffer definition */ static struct element { char *p; int len; } *array; /* The two semaphores to synchonize accesses to the circular buffer */ CSemaphore empty,full; /* Number of buffers produced and consumed */ int produced = 0,consumed = 0; /* Variable used for error reporting between disk writer thread and main thread reading from the network */ static int write_error = 0; /* Variable set by the main thread reading from the network to tell the disk reader thread to stop */ static int stop_read; extern char *getconfent() ; extern int checkkey(); extern char localdomain[MAXHOSTNAMELEN]; extern struct passwd stagersuperuser; int chsuser() ; /* Forward declaration */ static int chksuser() ; /* Forward declaration */ #if defined(_WIN32) #if !defined (MAX_THREADS) #define MAX_THREADS 64 #endif /* MAX_THREADS */ extern DWORD tls_i; /* thread local storage index */ extern struct thData { SOCKET ns; /* control socket */ struct sockaddr_storage from; int fromlen; int mode; int _is_remote; int fd; /* all globals, which have to be local for thread */ char *rqstbuf; /* Request buffer */ char *filename; /* file name */ char *iobuffer; /* Data communication buffer */ int iobufsiz; /* Current io buffer size */ SOCKET data_s; /* Data listen socket (v3) */ SOCKET data_sock; /* Data accept socket (v3) */ SOCKET ctrl_sock; /* the control socket (v3) */ int first_write; int first_read; int byte_read_from_network; struct rfiostat myinfo; char from_host[MAXHOSTNAMELEN]; /* Context for the open/firstwrite/close handlers */ void *handler_context; } *td; #define rqstbuf td->rqstbuf #define filename td->filename #define iobuffer td->iobuffer #define iobufsiz td->iobufsiz #define data_s td->data_s #define data_sock td->data_sock #define ctrl_sock td->ctrl_sock #define first_write td->first_write #define first_read td->first_read #define byte_read_from_network td->byte_read_from_network #define is_remote td->_is_remote #define myinfo td->myinfo #define handler_context td->handler_context #else /* if defined(_WIN32) */ /* * Buffer declarations */ char rqstbuf[BUFSIZ] ; /* Request buffer */ char filename[MAXFILENAMSIZE]; /* file name */ static char *iobuffer ; /* Data communication buffer */ static int iobufsiz= 0; /* Current io buffer size */ /* Context for the open/firstwrite/close handlers */ static void *handler_context; #endif /* WIN32 */ #if defined(_WIN32) #define ECONNRESET WSAECONNRESET #endif /* WIN32 */ /************************************************************************/ /* */ /* IO HANDLERS */ /* */ /************************************************************************/ int srrequest(s,bet) SOCKET s; int *bet; { char * p ; WORD magic ; WORD code ; int n ; fd_set fds ; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif FD_ZERO(&fds) ; FD_SET(s,&fds) ; serrno = 0; if( select(s+1, &fds, (fd_set*)0, (fd_set*)0, NULL) == SOCKET_ERROR ) { log(LOG_ERR,"rrequest(): select(): %s\n", neterror()); return -1; } if ( ! FD_ISSET(s,&fds) ) { log(LOG_ERR,"rrequest(): select() returns OK but FD_ISSET not\n") ; return -1 ; } log(LOG_DEBUG, "rrequest: reading %d bytes\n",RQSTSIZE) ; serrno = 0; if ((n = netread_timeout(s,rqstbuf,RQSTSIZE,RFIO_CTRL_TIMEOUT)) != RQSTSIZE) { if (n == 0) { return 0 ; } else { log(LOG_ERR, "rrequest: read(): %s\n", neterror()); return -1 ; } } p= rqstbuf ; unmarshall_WORD(p,magic) ; unmarshall_WORD(p,code) ; log(LOG_DEBUG,"rrequest: magic: %x code: %x\n",magic,code) ; *bet= ( magic == RFIO_MAGIC ? 0 : 1 ) ; return code ; } int srchkreqsize(s, p, len) SOCKET s; char *p; int len; { char tmpbuf[1024]; int templen = 1024; if ( p == NULL ) { errno = EINVAL; return(-1); } if ( len <=0 ) return(0); if ( p+len > rqstbuf+sizeof(rqstbuf) ) { log(LOG_ERR,"rchkreqsize() request too long (%d > %d)\n",len, (int)(sizeof(rqstbuf)-(p-rqstbuf))); errno = E2BIG; /* empty the buffer */ while (netread_timeout(s, tmpbuf, templen, RFIO_CTRL_TIMEOUT) == templen); return(-1); } return(0); } int srchk(s) SOCKET s; { char * p ; int status = 0 ; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p = rqstbuf ; marshall_LONG(p,status); serrno = 0; if ( netwrite_timeout(s, rqstbuf ,LONGSIZE, RFIO_CTRL_TIMEOUT) != LONGSIZE ) { log(LOG_ERR,"srchk(): netwrite_timeout(): %s\n", neterror()); return -1 ; } return 0 ; } #if !defined(_WIN32) int srsymlink(s,request,rt, host) int s ; int request ; int rt; /* Is it a remote site call ? */ char *host; /* Where the request comes from */ { char * p ; int status=0 ; int len ; char user[CA_MAXUSRNAMELEN+1] ; char name1[MAXFILENAMSIZE] ; char name2[MAXFILENAMSIZE] ; int rcode ; int uid,gid ; p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p, len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { /* * Reading symlink request. */ log(LOG_DEBUG,"rlink: reading %d bytes\n",len) ; log(LOG_DEBUG,"remote ? %s\n", (rt?"yes":"no")); serrno = 0; if (netread_timeout(s,rqstbuf,len,RFIO_CTRL_TIMEOUT) != len) { log(LOG_ERR,"rlink: read() error: %s\n",neterror()); return -1 ; } p= rqstbuf ; unmarshall_WORD(p, uid) ; unmarshall_WORD(p, gid) ; get_client_actual_id(&uid, &gid, NULL, NULL, &rt, NULL); *name1 = *name2 = *user = '\0'; if (unmarshall_STRINGN(p, name1, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } if (unmarshall_STRINGN(p, name2, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } if (unmarshall_STRINGN(p, user, CA_MAXUSRNAMELEN+1) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } /* * Mapping of user if call is issued from another site. */ if ( (status==0) && rt ) { char to[100]; int rcd; int to_uid, to_gid ; if ( (rcd = get_user(host,user,uid,gid,to,&to_uid,&to_gid)) == -ENOENT ) { log(LOG_ERR,"r%slink: get_user(): Error opening mapping file\n",(name1[0]=='\0' ? "un":"sym")) ; status= -1; errno = EINVAL; rcode = errno ; } if ( !status && abs(rcd) == 1 ) { log(LOG_ERR,"No entry in mapping file for (%s,%s,%d,%d)\n", host,user,uid,gid); status= -1; errno=EACCES; rcode=errno; } else { log(LOG_DEBUG,"(%s,%s,%d,%d) mapped to %s(%d,%d)\n", host, user, uid, gid, to, to_uid, to_gid) ; uid = to_uid ; gid = to_gid ; } } if ( (status == 0) && ((status = chsuser(uid,gid,host,&rcode,"WTRUST")) < 0) && ((status = chsuser(uid,gid,host,&rcode,"LINKTRUST")) < 0) ) { if ( status == -2 ) log(LOG_ERR,"srsymlink(): UID %d not allowed to r%slink().\n",uid,(name1[0]=='\0' ? "un":"sym")) ; else log(LOG_ERR,"srsymlink(): failed, rcode = %d\n",rcode); } if ( status == 0 ) { if (name1[0]=='\0') { status = unlink(name2) ; rcode = (status < 0 ? errno: 0) ; log(LOG_INFO ,"runlink(): unlink(%s) returned %d, rcode=%d\n",name2,status,rcode); } else { log(LOG_INFO, "unlink for (%d, %d)\n",getuid(), getgid()) ; status = symlink( name1, name2 ) ; rcode = (status < 0 ? errno: 0) ; log(LOG_INFO ,"rsymlink(): symlink(%s,%s) returned %d,rcode=%d\n",name1, name2, status,rcode ) ; } } } /* * Sending back status. */ p= rqstbuf ; marshall_WORD(p,request) ; marshall_LONG(p,status); marshall_LONG(p,rcode) ; #if defined(SACCT) rfioacct(RQST_SYMLINK,uid,gid,s,0,0,status,rcode,NULL,name1,name2); #endif /* SACCT */ log(LOG_DEBUG, "rlink: sending back status(%d) and errno (%d) \n",status,rcode); serrno = 0; if (netwrite_timeout(s,rqstbuf,WORDSIZE+2*LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+2*LONGSIZE)) { log(LOG_ERR,"rlink: netwrite_timeout(): %s\n",neterror()) ; return -1 ; } return status ; } int srreadlink(s) int s ; { char * p ; int status=0 ; int len=0 ; char path[MAXFILENAMSIZE] ; /* link file path to read */ char lpath[MAXFILENAMSIZE] ; /* link returned by readlink() */ int rcode ; int uid,gid ; /* Requestor's uid & gid */ p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p, len) ; lpath[0] = '\0'; if ( (status = srchkreqsize(s,p,len)) == -1 ) { *lpath = '\0'; rcode = errno; } else { /* * Reading readlink request. */ log(LOG_DEBUG,"srreadlink(): reading %d bytes\n",len) ; serrno = 0; if (netread_timeout(s,rqstbuf,len,RFIO_CTRL_TIMEOUT) != len) { log(LOG_ERR,"srreadlink() : read() error: %s\n",neterror()); return -1 ; } p= rqstbuf ; unmarshall_WORD(p, uid) ; unmarshall_WORD(p, gid) ; get_client_actual_id(&uid, &gid, NULL, NULL, NULL, NULL); *path = '\0'; if ( (status == 0) && (status = unmarshall_STRINGN( p, path, MAXFILENAMSIZE)) == -1 ) rcode = SENAMETOOLONG; (void) setgroups(0, NULL); if (gid == -1 || uid == -1) { status= -1; rcode= EACCES; log(LOG_ERR,"srreadlink(): denied\n"); } else if ( (setgid(gid)<0) || (setuid(uid)<0) ) { status= -1 ; rcode= errno ; log(LOG_ERR,"srreadlink(): unable to setuid,gid(%d,%d): %s, we are (uid=%d,gid=%d,euid=%d,egid=%d)\n",uid,gid,strerror(errno),(int) getuid(),(int) getgid(),(int) geteuid(),(int) getegid()) ; } log(LOG_INFO,"srreadlink() : Solving %s\n",path); if (status == 0) { rcode = readlink( path, lpath, MAXFILENAMSIZE) ; if (rcode < 0) { lpath[0]='\0' ; status = -1 ; rcode = errno ; } else { lpath[rcode]='\0' ; } } } p= rqstbuf ; len = strlen(lpath) + 1 ; marshall_LONG(p,len) ; marshall_LONG(p,status); marshall_LONG(p,rcode); if (status == 0 ) marshall_STRING(p,lpath); #if defined(SACCT) rfioacct(RQST_READLINK,uid,gid,s,0,0,status,rcode,NULL,path,lpath); #endif /* SACCT */ serrno = 0; if (netwrite_timeout(s,rqstbuf,len+3*LONGSIZE,RFIO_CTRL_TIMEOUT) != (len+3*LONGSIZE)) { log(LOG_ERR, "srreadlink(): netwrite_timeout(): %s\n", neterror()); return(-1); } return (status) ; } int srchown(s,host,rt) int s; char *host ; int rt ; { char *p ; LONG status = 0; LONG len ; int uid,gid ; int owner, group ; int rcode = 0 ; p = rqstbuf + (2*WORDSIZE) ; unmarshall_WORD(p, uid) ; unmarshall_WORD(p, gid) ; get_client_actual_id(&uid, &gid, NULL, NULL, &rt, NULL); unmarshall_LONG(p, len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { /* * Reading chown request. */ log(LOG_DEBUG, "rchown for (%d,%d): reading %d bytes\n", uid,gid,len); /* chown() is not for remote users */ if ( rt ) { status = -1; rcode = EACCES ; log(LOG_ERR,"Attempt to srchown() from %s denied\n",host); } else { if ( ((status = chsuser(uid,gid,host,&rcode,"WTRUST")) < 0) && ((status = chsuser(uid,gid,host,&rcode,"CHOWNTRUST")) < 0) ) { if (status == -2) log(LOG_ERR,"srchown(): UID %d not allowed to chown\n",uid); else log(LOG_ERR,"srchown(): failed, rcode = %d\n",rcode); status = -1 ; } serrno = 0; if (netread_timeout(s, rqstbuf, len, RFIO_CTRL_TIMEOUT) != len) { log(LOG_ERR, "srchown(): read(): %s\n", neterror()); return -1; } p = rqstbuf ; *filename = '\0'; if (unmarshall_STRINGN(p, filename, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } unmarshall_WORD(p,owner); unmarshall_WORD(p,group); log(LOG_INFO,"rchown: filename: %s, uid: %d ,gid: %d\n",filename,owner,group); if (status == 0 ) { if ( (status = chown(filename,owner,group)) < 0 ) rcode = errno ; else status = 0 ; } } } p = rqstbuf ; marshall_LONG(p, status); marshall_LONG(p, rcode); #if defined(SACCT) rfioacct(RQST_CHOWN,uid,gid,s,(int)owner,(int)group,status,rcode,NULL,filename,NULL); #endif /* SACCT */ log(LOG_DEBUG, "srchown: sending back status %d rcode %d\n", status,rcode); serrno = 0; if (netwrite_timeout(s, rqstbuf, 2*LONGSIZE, RFIO_CTRL_TIMEOUT) != (2*LONGSIZE)) { log(LOG_ERR, "srchown(): netwrite_timeout(): %s\n", neterror()); return -1 ; } return status ; } #endif /* !WIN32 */ int srchmod(s,host,rt) SOCKET s; char *host ; int rt ; { char *p ; LONG status = 0; LONG len ; LONG mode ; int uid,gid ; int rcode = 0 ; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p = rqstbuf + (2*WORDSIZE) ; unmarshall_WORD(p, uid) ; unmarshall_WORD(p, gid) ; get_client_actual_id(&uid, &gid, NULL, NULL, &rt, NULL); unmarshall_LONG(p, len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { /* * Reading chmod request. */ log(LOG_DEBUG, "rchmod for (%d,%d): reading %d bytes\n", uid,gid,len); /* chmod() is not for remote users */ (void)umask(0) ; if ( rt ) { status = -1; rcode = EACCES ; log(LOG_ERR,"Attempt to srchmod() from %s denied\n",host); } else { if ( ((status=chsuser(uid,gid,host,&rcode,"WTRUST")) < 0) && ((status=chsuser(uid,gid,host,&rcode,"CHMODTRUST")) < 0) ) { if (status == -1) log(LOG_ERR,"srchmod(): UID %d not allowed to chmod()\n",uid); else log(LOG_ERR,"srchmod(): failed, rcode = %d\n",rcode); status = -1 ; } serrno = 0; if (netread_timeout(s, rqstbuf, len, RFIO_CTRL_TIMEOUT) != len) { log(LOG_ERR, "srchmod(): read(): %s\n", neterror()); return -1; } p = rqstbuf ; *filename = '\0'; if (unmarshall_STRINGN(p, filename, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } unmarshall_LONG(p, mode) ; log(LOG_INFO,"chmod: filename: %s, mode: %o\n", filename, mode) ; if (status == 0 ) { if ( (status = chmod(filename, mode)) < 0 ) rcode = errno ; else status = 0 ; } } } p = rqstbuf ; marshall_LONG(p, status); marshall_LONG(p, rcode); #if defined(SACCT) rfioacct(RQST_CHMOD,uid,gid,s,0,(int)mode,status,rcode,NULL,filename,NULL); #endif /* SACCT */ log(LOG_DEBUG, "srchmod: sending back status %d rcode %d\n", status,rcode); serrno = 0; if (netwrite_timeout(s, rqstbuf, 2*LONGSIZE, RFIO_CTRL_TIMEOUT) != (2*LONGSIZE)) { log(LOG_ERR, "srchmod(): netwrite_timeout(): %s\n", neterror()); return -1 ; } return status ; } int srmkdir(s,host,rt) SOCKET s; char *host ; int rt ; { char *p ; LONG status = 0; LONG len ; LONG mode ; int uid,gid ; int rcode = 0 ; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p = rqstbuf + (2*WORDSIZE) ; unmarshall_WORD(p, uid) ; unmarshall_WORD(p, gid) ; get_client_actual_id(&uid, &gid, NULL, NULL, &rt, NULL); unmarshall_LONG(p, len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { /* * Reading mkdir request. */ log(LOG_DEBUG, "rmkdir for (%d,%d): reading %d bytes\n", uid,gid,len); /* mkdir() is not for remote users */ (void)umask(0) ; if ( rt ) { status = -1; rcode = EACCES ; log(LOG_ERR,"Attempt to srmkdir() from %s denied\n",host); } else { if ( ((status=chsuser(uid,gid,host,&rcode,"WTRUST")) < 0) && ((status=chsuser(uid,gid,host,&rcode,"MKDIRTRUST")) < 0) ) { if (status == -1) log(LOG_ERR,"srmkdir(): UID %d not allowed to mkdir()\n",uid); else log(LOG_ERR,"srmkdir(): failed, rcode = %d\n",rcode); status = -1 ; } serrno = 0; if (netread_timeout(s, rqstbuf, len, RFIO_CTRL_TIMEOUT) != len) { log(LOG_ERR, "srmkdir(): read(): %s\n", neterror()); return -1; } p = rqstbuf ; *filename = '\0'; if (unmarshall_STRINGN(p, filename, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } unmarshall_LONG(p, mode) ; log(LOG_INFO,"rmkdir: filename: %s, mode: %o\n", filename, mode) ; if (status == 0 ) { if ( (status = mkdir(filename, mode)) < 0 ) rcode = errno ; else status = 0 ; } } } p = rqstbuf ; marshall_LONG(p, status); marshall_LONG(p, rcode); #if defined(SACCT) rfioacct(RQST_MKDIR,uid,gid,s,0,(int)mode,status,rcode,NULL,filename,NULL); #endif /* SACCT */ log(LOG_DEBUG, "srmkdir: sending back status %d rcode %d\n", status,rcode); serrno = 0; if (netwrite_timeout(s, rqstbuf, 2*LONGSIZE, RFIO_CTRL_TIMEOUT) != (2*LONGSIZE)) { log(LOG_ERR, "srmkdir(): netwrite_timeout(): %s\n", neterror()); return -1 ; } return status ; } int rcp (SOCKET s, char *source, char *destination, char *clienthost, char *mech, char *auth_id, uid_t uid, gid_t gid, int timeout) { int bufsize = 128 * 1024; char *cp; fd_set fds; char *filename; char *host; int inpbytes; int inpfd; char *iobuffer; mode_t mode; int outbytes; int outfd; int rc; int rcode = 0; struct stat64 statbuf; int status; time_t time0; struct timeval tval; int v; time0 = time(0); if (cp = getenv ("RFIO_READOPT")) { v = atoi (cp); rfiosetopt (RFIO_READOPT, &v , 4); } /* open source */ if ((rc = rfio_parse (source, &host, &filename)) < 0) return (-1); if (rc) { /* remote file */ if (rfio_handle_remote_open (source, mech, auth_id, uid, gid) < 0) { log(LOG_DEBUG, "rcp: rfio_handle_remote_open refused open: %s\n", sstrerror(serrno)) ; return (-1); } serrno = rfio_errno = 0; if ((inpfd = rfio_open64 (source, O_RDONLY, 0644)) < 0) { log(LOG_DEBUG, "rcp: open: %s\n", rfio_serror()) ; return (-1); } } else if (host) { /* DPM managed file */ serrno = SEOPNOTSUP; return (-1); } else { /* local file */ char *pfn = NULL; int need_user_check = 1; if (rfio_handle_open (filename, O_RDONLY, 0644, mech, auth_id, uid, gid, &pfn, &handler_context, &need_user_check) < 0) { log(LOG_DEBUG, "rcp: rfio_handle_open refused open: %s\n", sstrerror(serrno)) ; return (-1); } if (pfn) free (pfn); if (need_user_check && ((status=chsuser(uid,gid,clienthost,&rcode,"RTRUST")) < 0) && ((status=chsuser(uid,gid,clienthost,&rcode,"OPENTRUST")) < 0) ) { if (status == -2) log(LOG_ERR, "rcp: uid %d not allowed to open()\n", uid); else log(LOG_ERR, "rcp: failed at chsuser(), rcode %d\n", rcode); serrno = rcode; return (-1); } if ((inpfd = open64 (filename, O_RDONLY, 0644)) < 0) { serrno = errno; log(LOG_DEBUG, "rcp: open: %s\n", strerror(errno)) ; return (-1); } } /* get source file mode */ if (rfio_fstat64 (inpfd, &statbuf) < 0) { log(LOG_DEBUG, "rcp: fstat: %s\n", rfio_serror()) ; return (-1); } /* open destination */ if ((rc = rfio_parse (destination, &host, &filename)) < 0) return (-1); if (rc) { /* remote file */ if (rfio_handle_remote_open (destination, mech, auth_id, uid, gid) < 0) { log(LOG_DEBUG, "rcp: rfio_handle_remote_open refused open: %s\n", sstrerror(serrno)) ; return (-1); } serrno = rfio_errno = 0; if ((outfd = rfio_open64 (destination, O_WRONLY|O_CREAT|O_TRUNC, statbuf.st_mode & 0777)) < 0) { log(LOG_DEBUG, "rcp: open: %s\n", rfio_serror()) ; return (-1); } } else if (host) { /* DPM managed file */ serrno = SEOPNOTSUP; return (-1); } else { /* local file */ char *pfn = NULL; int need_user_check = 1; if (rfio_handle_open (filename, O_WRONLY|O_CREAT|O_TRUNC, 0644, mech, auth_id, uid, gid, &pfn, &handler_context, &need_user_check) < 0) { log(LOG_DEBUG, "rcp: rfio_handle_open refused open: %s\n", sstrerror(serrno)) ; return (-1); } if (pfn) free (pfn); if (need_user_check && ((status=chsuser(uid,gid,clienthost,&rcode,"WTRUST")) < 0) && ((status=chsuser(uid,gid,clienthost,&rcode,"OPENTRUST")) < 0) ) { if (status == -2) log(LOG_ERR, "rcp: uid %d not allowed to open()\n", uid); else log(LOG_ERR, "rcp: failed at chsuser(), rcode %d\n", rcode); serrno = rcode; return (-1); } if (! need_user_check) { /* managed file */ mode = 0660; (void) umask(0) ; } else mode = statbuf.st_mode & 0777; if ((outfd = open64 (filename, O_WRONLY|O_CREAT|O_TRUNC, mode)) < 0) { serrno = errno; log(LOG_DEBUG, "rcp: open: %s\n", strerror(errno)) ; return (-1); } if (! need_user_check) /* new managed file instance */ chown(filename, stagersuperuser.pw_uid, stagersuperuser.pw_gid); } /* Allocate buffer */ if ((iobuffer = malloc (bufsize)) == NULL) { serrno = errno; log(LOG_ERR, "rcp: malloc(): %s\n", strerror(errno)); return (-1); } /* Copy file */ while (1) { if (timeout && (time(0) - time0 > timeout)) { rcode = SETIMEDOUT; outbytes = -1; break; } /* check for activity on the control channel */ FD_ZERO(&fds); FD_SET(s,&fds); tval.tv_sec = 0; tval.tv_usec= 0; serrno = 0; if( select(s+1, &fds, (fd_set*)0, (fd_set*)0, &tval) == SOCKET_ERROR ) { rcode = errno; log(LOG_ERR,"rcp(): select(): %s\n", neterror()); outbytes = -1; break; } if ( FD_ISSET(s,&fds) ) { log(LOG_ERR,"rcp(): unexpected disconnect or data on control channel, cancelling copy\n"); rcode = ECANCELED; outbytes = -1; break; } /* read from source and write to destination */ if ((inpbytes = rfio_read (inpfd, iobuffer, bufsize)) < 0) { rcode = rfio_serrno(); log(LOG_DEBUG, "rcp: read: %s\n", rfio_serror()) ; break; } if (inpbytes == 0) break; if ((outbytes = rfio_write (outfd, iobuffer, inpbytes)) < 0) { rcode = rfio_serrno(); log(LOG_DEBUG, "rcp: write: %s\n", rfio_serror()) ; break; } if (outbytes < inpbytes) { rcode = ENOSPC; outbytes = -1; break; } } rfio_close (inpfd); rfio_close (outfd); if (inpbytes < 0 || outbytes < 0) { serrno = rcode; return (-1); } return (0); } int srrcp(s,host,rt) SOCKET s; char *host ; int rt ; { char *auth_id ; char destination[MAXFILENAMSIZE] ; LONG len ; WORD mask ; char *mech ; char *p ; int rcode = 0 ; char source[MAXFILENAMSIZE] ; LONG status = 0; LONG timeout ; int uid,gid ; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p = rqstbuf + (2*WORDSIZE) ; unmarshall_WORD(p, uid) ; unmarshall_WORD(p, gid) ; get_client_actual_id(&uid, &gid, &mech, &auth_id, &rt, NULL); unmarshall_WORD(p, mask) ; unmarshall_LONG(p, timeout) ; unmarshall_LONG(p, len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { /* * Reading rcp request. */ log(LOG_DEBUG, "srrcp for (%d,%d): reading %d bytes\n", uid,gid,len); /* rcp() is not for remote users */ if ( rt ) { status = -1; rcode = EACCES ; log(LOG_ERR,"Attempt to srrcp() from %s denied\n",host); } else { serrno = 0; if (netread_timeout(s, rqstbuf, len, RFIO_CTRL_TIMEOUT) != len) { log(LOG_ERR, "srrcp(): read(): %s\n", neterror()); return -1; } p = rqstbuf ; *source = *destination = '\0'; if ( (status = unmarshall_STRINGN(p, source,MAXFILENAMSIZE)) == -1) rcode = SENAMETOOLONG; if ( (status == 0) && (status = unmarshall_STRINGN(p, destination,MAXFILENAMSIZE)) == -1) rcode = SENAMETOOLONG; log(LOG_INFO,"srrcp: source %s, destination %s\n", source, destination); if (status == 0 ) { (void) umask(mask); if ( (status = rcp(s, source, destination, host, mech, auth_id, uid, gid, timeout)) < 0 ) rcode = rfio_serrno() ; else rcode = 0 ; } } } p = rqstbuf ; marshall_LONG(p, status); marshall_LONG(p, rcode); #if defined(SACCT) rfioacct(RQST_RCP,uid,gid,s,0,0,status,rcode,NULL,source,destination); #endif /* SACCT */ log(LOG_DEBUG, "srrcp: sending back status %d rcode %d\n", status,rcode); serrno = 0; if (netwrite_timeout(s, rqstbuf, 2*LONGSIZE, RFIO_CTRL_TIMEOUT) != (2*LONGSIZE)) { log(LOG_ERR, "srrcp(): netwrite_timeout(): %s\n", neterror()); return -1 ; } return status ; } int srrmdir(s,host,rt) SOCKET s; char *host ; int rt ; { char *p ; LONG status = 0; LONG len ; int uid,gid ; int rcode = 0 ; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p = rqstbuf + (2*WORDSIZE) ; unmarshall_WORD(p, uid) ; unmarshall_WORD(p, gid) ; get_client_actual_id(&uid, &gid, NULL, NULL, &rt, NULL); unmarshall_LONG(p, len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { /* * Reading rmdir request. */ log(LOG_DEBUG, "rrmdir for (%d,%d): reading %d bytes\n", uid,gid,len); /* rmdir() is not for remote users */ (void)umask(0) ; if ( rt ) { status = -1; rcode = EACCES ; log(LOG_ERR,"Attempt to srrmdir() from %s denied\n",host); } else { if ( ((status=chsuser(uid,gid,host,&rcode,"WTRUST")) < 0) && ((status=chsuser(uid,gid,host,&rcode,"RMDIRTRUST")) < 0) ) { if (status == -1) log(LOG_ERR,"srrmdir(): UID %d not allowed to rmdir()\n",uid); else log(LOG_ERR,"srrmdir(): failed, rcode = %d\n",rcode); status = -1 ; } serrno = 0; if (netread_timeout(s, rqstbuf, len, RFIO_CTRL_TIMEOUT) != len) { log(LOG_ERR, "srrmdir(): read(): %s\n", neterror()); return -1; } p = rqstbuf ; *filename = '\0'; if (unmarshall_STRINGN(p, filename, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } log(LOG_INFO,"rrmdir: filename: %s\n", filename) ; if (status == 0 ) { if ( (status = rmdir(filename)) < 0 ) rcode = errno ; else status = 0 ; } } } p = rqstbuf ; marshall_LONG(p, status); marshall_LONG(p, rcode); #if defined(SACCT) rfioacct(RQST_MKDIR,uid,gid,s,0,0,status,rcode,NULL,filename,NULL); #endif /* SACCT */ log(LOG_DEBUG, "srrmdir: sending back status %d rcode %d\n", status,rcode); serrno = 0; if (netwrite_timeout(s, rqstbuf, 2*LONGSIZE, RFIO_CTRL_TIMEOUT) != (2*LONGSIZE)) { log(LOG_ERR, "srrmdir(): netwrite_timeout(): %s\n", neterror()); return -1 ; } return status ; } int srrename(s,host,rt) SOCKET s; char *host ; int rt ; { char *p ; LONG status = 0; LONG len ; int uid,gid ; char filenameo[MAXFILENAMSIZE] ; char filenamen[MAXFILENAMSIZE] ; int rcode = 0 ; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p = rqstbuf + (2*WORDSIZE) ; unmarshall_WORD(p, uid) ; unmarshall_WORD(p, gid) ; get_client_actual_id(&uid, &gid, NULL, NULL, &rt, NULL); unmarshall_LONG(p, len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { /* * Reading rename request. */ log(LOG_DEBUG, "srrename for (%d,%d): reading %d bytes\n", uid,gid,len); /* rename() is not for remote users */ if ( rt ) { status = -1; rcode = EACCES ; log(LOG_ERR,"Attempt to srrename() from %s denied\n",host); } else { if ( ((status=chsuser(uid,gid,host,&rcode,"WTRUST")) < 0) && ((status=chsuser(uid,gid,host,&rcode,"RENAMETRUST")) < 0) ) { if (status == -1) log(LOG_ERR,"srrename(): UID %d not allowed to rename()\n",uid); else log(LOG_ERR,"srrename(): failed, rcode = %d\n",rcode); status = -1 ; } serrno = 0; if (netread_timeout(s, rqstbuf, len, RFIO_CTRL_TIMEOUT) != len) { log(LOG_ERR, "srrename(): read(): %s\n", neterror()); return -1; } p = rqstbuf ; *filenameo = *filenamen = '\0'; if (unmarshall_STRINGN(p, filenameo, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } if (unmarshall_STRINGN(p, filenamen, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } log(LOG_INFO,"srrename: filenameo %s, filenamen %s\n", filenameo, filenamen); if (status == 0 ) { if ( (status = rename(filenameo, filenamen)) < 0 ) rcode = errno ; else status = 0 ; } } } p = rqstbuf ; marshall_LONG(p, status); marshall_LONG(p, rcode); #if defined(SACCT) rfioacct(RQST_RENAME,uid,gid,s,0,0,status,rcode,NULL,filenameo,filenamen); #endif /* SACCT */ log(LOG_DEBUG, "srrename: sending back status %d rcode %d\n", status,rcode); serrno = 0; if (netwrite_timeout(s, rqstbuf, 2*LONGSIZE, RFIO_CTRL_TIMEOUT) != (2*LONGSIZE)) { log(LOG_ERR, "srrename(): netwrite_timeout(): %s\n", neterror()); return -1 ; } return status ; } #if !defined(_WIN32) int srlockf(s,fd) int s; int fd; { char *p ; LONG status = 0; LONG len ; int uid,gid ; int op; long siz; int rcode = 0 ; p = rqstbuf + (2*WORDSIZE) ; unmarshall_WORD(p, uid) ; unmarshall_WORD(p, gid) ; unmarshall_LONG(p, len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { /* * Reading lockf request. */ log(LOG_DEBUG, "srlockf(%d,%d): reading %d bytes\n", s,fd,len); serrno = 0; if (netread_timeout(s, rqstbuf, len, RFIO_CTRL_TIMEOUT) != len) { log(LOG_ERR, "srlockf(): read(): %s\n", neterror()); return -1; } p = rqstbuf ; unmarshall_LONG(p, op) ; unmarshall_LONG(p, siz); log(LOG_INFO,"srlockf: op %d, siz %ld\n", op, siz); if (status == 0 ) { if ( (status = lockf(fd, op, siz)) < 0 ) rcode = errno ; else status = 0 ; } } p = rqstbuf ; marshall_LONG(p, status); marshall_LONG(p, rcode); #if defined(SACCT) rfioacct(RQST_LOCKF,uid,gid,s,op,(int)siz,status,rcode,NULL,NULL,NULL); #endif /* SACCT */ log(LOG_DEBUG, "srlockf: sending back status %d rcode %d\n", status,rcode); serrno = 0; if (netwrite_timeout(s, rqstbuf, 2*LONGSIZE, RFIO_CTRL_TIMEOUT) != (2*LONGSIZE)) { log(LOG_ERR, "srlockf(): netwrite_timeout(): %s\n", neterror()); return -1 ; } return status ; } #endif /* !WIN32 */ int srerrmsg(s) SOCKET s; { int code ; int len ; char * msg ; char * p ; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p, code); log(LOG_INFO, "rerrmsg: code: %d\n",code) ; msg= (code > 0) ? strerror(code) : "Invalid error code" ; msg = strdup(msg); log(LOG_DEBUG, "rerrmsg: errmsg: %s\n",msg); len= strlen(msg)+1 ; p = rqstbuf ; marshall_LONG(p,len) ; marshall_STRING(p,msg) ; log(LOG_DEBUG, "rerrmsg: sending back %d bytes\n",len+LONGSIZE); free(msg); serrno = 0; if (netwrite_timeout(s,rqstbuf,len+LONGSIZE,RFIO_CTRL_TIMEOUT) != (len+LONGSIZE)) { log(LOG_ERR, "rerrmsg: netwrite_timeout(): %s\n", neterror()); return(-1); } return(0); } #if !defined(_WIN32) int srlstat(s,rt,host,bet) int s; int rt; /* Is it a remote site call ? */ char *host; /* Where the request comes from */ int bet ; /* Version indicator: 0(old) or 1(new) */ { char *auth_id; char *mech; int need_user_check = 1; char * p ; int status = 0, rcode = 0; int len ; struct stat statbuf ; char user[CA_MAXUSRNAMELEN+1]; int uid,gid; p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p,len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { /* * Reading lstat request. */ log(LOG_DEBUG,"rlstat: reading %d bytes\n",len); serrno = 0; if ((status = netread_timeout(s,rqstbuf,len,RFIO_CTRL_TIMEOUT)) != len) { log(LOG_ERR,"rlstat: read(): %s\n",neterror()); return -1; } p= rqstbuf ; status = uid = gid = 0; if (bet) { unmarshall_WORD(p,uid); unmarshall_WORD(p,gid); *user = '\0'; if (unmarshall_STRINGN(p, user, CA_MAXUSRNAMELEN+1) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } } get_client_actual_id(&uid, &gid, &mech, &auth_id, &rt, NULL); *filename = '\0'; if (unmarshall_STRINGN(p, filename, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } if ( (status == 0) && bet && rt ) { char to[100]; int rcd; int to_uid, to_gid ; if ( (rcd = get_user(host,user,uid,gid,to,&to_uid,&to_gid)) == -ENOENT ) { log(LOG_ERR,"rlstat: get_user(): Error opening mapping file\n") ; status= -1; errno = EINVAL; rcode = errno ; } if ( !status && abs(rcd) == 1 ) { log(LOG_ERR,"No entry in mapping file for (%s,%s,%d,%d)\n", host,user,uid,gid); status= -1; errno=EACCES; rcode=errno; } else { log(LOG_DEBUG,"(%s,%s,%d,%d) mapped to %s(%d,%d)\n", host,user,uid,gid,to,to_uid,to_gid) ; uid = to_uid ; gid = to_gid ; } } if ( !status ) { status = rfio_handle_stat(filename, 1, mech, auth_id, uid, gid, &statbuf, &need_user_check); if (status < 0) { char alarmbuf[1024]; rcode = serrno; sprintf(alarmbuf,"rlstat(): %s",filename) ; log(LOG_DEBUG, "rlstat: rfio_handler_stat refused stat: %s\n", sstrerror(serrno)) ; rfio_alrm(rcode,alarmbuf) ; memset(&statbuf,'\0',sizeof(statbuf)); } } if ( !status && need_user_check) { if (bet && (status=chsuser(uid,gid,host,&rcode,"FTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"WTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"XTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"OPENTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"STATTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"POPENTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"LINKTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"CHMODTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"CHOWNTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"MKDIRTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RMDIRTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RENAMETRUST")) < 0 ) { if (status == -2) log(LOG_ERR,"rlstat(): uid %d not allowed to stat()\n",uid); else log(LOG_ERR,"rlstat(): failed at chsuser(), rcode %d\n",rcode); memset(&statbuf,'\0',sizeof(statbuf)); status = rcode ; } else { status= ( lstat(filename, &statbuf) < 0 ) ? errno : 0 ; log(LOG_INFO,"rlstat: file: %s , status %d\n",filename,status) ; } } } p = rqstbuf ; marshall_WORD(p, statbuf.st_dev); marshall_LONG(p, statbuf.st_ino); marshall_WORD(p, statbuf.st_mode); marshall_WORD(p, statbuf.st_nlink); marshall_WORD(p, statbuf.st_uid); marshall_WORD(p, statbuf.st_gid); marshall_LONG(p, statbuf.st_size); marshall_LONG(p, statbuf.st_atime); marshall_LONG(p, statbuf.st_mtime); marshall_LONG(p, statbuf.st_ctime); /* * Bug #2646. This is one of the rare cases when the errno * is returned in the status parameter. */ if ( status == -1 && rcode > 0 ) status = rcode; marshall_LONG(p, status); log(LOG_DEBUG, "rlstat: sending back %d\n", status); serrno = 0; if (netwrite_timeout(s,rqstbuf,6*LONGSIZE+5*WORDSIZE,RFIO_CTRL_TIMEOUT) != (6*LONGSIZE+5*WORDSIZE)) { log(LOG_ERR, "rlstat: netwrite_timeout(): %s\n", neterror()); return -1 ; } return 0 ; } #endif /* !WIN32 */ int srstat(s,rt,host,bet) SOCKET s; int rt; /* Is it a remote site call ? */ char *host; /* Where the request comes from */ int bet ; /* Version indicator: 0(old) or 1(new) */ { char *auth_id; char *mech; int need_user_check = 1; char * p ; int status = 0, rcode = 0; int len ; struct stat statbuf ; char user[CA_MAXUSRNAMELEN+1]; int uid,gid; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p,len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { /* * Reading stat request. */ log(LOG_DEBUG,"rstat: reading %d bytes\n",len); serrno = 0; if ((status = netread_timeout(s,rqstbuf,len,RFIO_CTRL_TIMEOUT)) != len) { log(LOG_ERR,"rstat: read(): %s\n", neterror()); return -1; } p= rqstbuf ; status = uid = gid = 0; if (bet) { unmarshall_WORD(p,uid); unmarshall_WORD(p,gid); *user = '\0'; if (unmarshall_STRINGN(p, user, CA_MAXUSRNAMELEN+1) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } } get_client_actual_id(&uid, &gid, &mech, &auth_id, &rt, NULL); if (unmarshall_STRINGN(p, filename, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } if ( (status == 0) && bet && rt ) { char to[100]; int rcd; int to_uid, to_gid ; if ( (rcd = get_user(host,user,uid,gid,to,&to_uid,&to_gid)) == -ENOENT ) { log(LOG_ERR,"rstat: get_user(): Error opening mapping file\n") ; status= -1; errno = EINVAL; rcode = errno ; } if ( !status && abs(rcd) == 1 ) { log(LOG_ERR,"No entry in mapping file for (%s,%s,%d,%d)\n", host,user,uid,gid); status= -1; errno=EACCES; rcode=errno; } else { log(LOG_DEBUG,"(%s,%s,%d,%d) mapped to %s(%d,%d)\n", host,user,uid,gid,to,to_uid,to_gid) ; uid = to_uid ; gid = to_gid ; } } if ( !status ) { status = rfio_handle_stat(filename, 0, mech, auth_id, uid, gid, &statbuf, &need_user_check); if (status < 0) { char alarmbuf[1024]; rcode = serrno; sprintf(alarmbuf,"rstat(): %s",filename) ; log(LOG_DEBUG, "rstat: rfio_handler_stat refused stat: %s\n", sstrerror(serrno)) ; rfio_alrm(rcode,alarmbuf) ; memset(&statbuf,'\0',sizeof(statbuf)); } } if ( !status && need_user_check) { /* * Trust root for stat() if trusted for any other privileged operation */ rcode = 0; if (bet && (status=chsuser(uid,gid,host,&rcode,"FTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"WTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"XTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"OPENTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"STATTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"POPENTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"LINKTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"CHMODTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"CHOWNTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"MKDIRTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RMDIRTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RENAMETRUST")) < 0 ) { if (status == -2) log(LOG_ERR,"rstat(): uid %d not allowed to stat()\n",uid); else log(LOG_ERR,"rstat(): failed at chsuser(), rcode %d\n",rcode); memset(&statbuf,'\0',sizeof(statbuf)); status = rcode ; } else { status= ( stat(filename, &statbuf) < 0 ) ? errno : 0 ; log(LOG_INFO,"rstat: stat(): file: %s for (%d,%d) status %d\n",filename,uid,gid,status) ; } } } p = rqstbuf ; marshall_WORD(p, statbuf.st_dev); marshall_LONG(p, statbuf.st_ino); marshall_WORD(p, statbuf.st_mode); marshall_WORD(p, statbuf.st_nlink); marshall_WORD(p, statbuf.st_uid); marshall_WORD(p, statbuf.st_gid); marshall_LONG(p, statbuf.st_size); marshall_LONG(p, statbuf.st_atime); marshall_LONG(p, statbuf.st_mtime); marshall_LONG(p, statbuf.st_ctime); /* * Bug #2646. This is one of the rare cases when the errno * is returned in the status parameter. */ if ( status == -1 && rcode > 0 ) status = rcode; marshall_LONG(p, status); #if !defined(_WIN32) marshall_LONG(p, statbuf.st_blksize); marshall_LONG(p, statbuf.st_blocks); #endif serrno = 0; if (netwrite_timeout(s,rqstbuf,8*LONGSIZE+5*WORDSIZE,RFIO_CTRL_TIMEOUT) != (8*LONGSIZE+5*WORDSIZE)) { log(LOG_ERR, "rstat: netwrite_timeout(): %s\n", neterror()); return -1 ; } return 0 ; } #if !defined(_WIN32) int sraccess(s, host, rt) int s; char *host; int rt; { char *auth_id; char *mech; int need_user_check = 1; char *p ; int status = 0; int len ,uid, gid; int mode ; int rcode = 0; p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p,len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { /* * Reading access request. */ log(LOG_DEBUG,"raccess: reading %d bytes\n",len); serrno = 0; if (netread_timeout(s,rqstbuf,len,RFIO_CTRL_TIMEOUT) != len) { log(LOG_ERR,"raccess: read(): %s\n",neterror()); return -1; } p= rqstbuf ; *filename = '\0'; if (unmarshall_STRINGN(p, filename, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } unmarshall_LONG(p,uid); unmarshall_LONG(p,gid); get_client_actual_id(&uid, &gid, &mech, &auth_id, &rt, NULL); unmarshall_LONG(p,mode); if (((mode & ~(R_OK | W_OK | X_OK)) != 0) && (mode != F_OK)) { status = EINVAL; log(LOG_ERR,"raccess: wrong mode 0x%x\n", mode); } if ( !status ) { status = rfio_handle_access(filename, mode, mech, auth_id, uid, gid, &need_user_check); if (status < 0) { char alarmbuf[1024]; rcode = serrno; sprintf(alarmbuf,"raccess(): %s",filename) ; log(LOG_DEBUG, "raccess: rfio_handler_access refused access: %s\n", sstrerror(serrno)) ; rfio_alrm(rcode,alarmbuf) ; } } if ( ! status && need_user_check ) { (void) setgroups(0, NULL); if (gid == -1 || uid == -1) { status = EACCES; log(LOG_ERR,"raccess: denied\n"); } else if ( (setgid(gid)<0) || (setuid(uid)<0) ) { status= errno ; log(LOG_ERR,"raccess: unable to setuid,gid(%d,%d): %s, we are (uid=%d,gid=%d,euid=%d,egid=%d)\n",uid,gid,strerror(errno),(int) getuid(),(int) getgid(),(int) geteuid(),(int) getegid()) ; } if (!status) { if ((mode & (R_OK | W_OK | X_OK)) != 0) { if ((mode & R_OK) == R_OK) { if ( (status=chsuser(uid,gid,host,&rcode,"RTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"OPENTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"STATTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"POPENTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"LINKTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"CHMODTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"CHOWNTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"MKDIRTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RMDIRTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RENAMETRUST")) < 0 ) { if (status == -2) log(LOG_ERR,"raccess(): uid %d not allowed to do access(R_OK)\n",uid); else log(LOG_ERR,"raccess(): failed at chsuser(), rcode %d\n",rcode); } } if ((! status) && ((mode & W_OK) == W_OK)) { if ( (status=chsuser(uid,gid,host,&rcode,"WTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"OPENTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"STATTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"POPENTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"LINKTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"CHMODTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"CHOWNTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"MKDIRTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RMDIRTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RENAMETRUST")) < 0 ) { if (status == -2) log(LOG_ERR,"raccess(): uid %d not allowed to do access(W_OK)\n",uid); else log(LOG_ERR,"raccess(): failed at chsuser(), rcode %d\n",rcode); } } if ((! status) && ((mode & X_OK) == X_OK)) { if ( (status=chsuser(uid,gid,host,&rcode,"XTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"OPENTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"STATTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"POPENTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"LINKTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"CHMODTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"CHOWNTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"MKDIRTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RMDIRTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RENAMETRUST")) < 0 ) { if (status == -2) log(LOG_ERR,"raccess(): uid %d not allowed to do access(X_OK)\n",uid); else log(LOG_ERR,"raccess(): failed at chsuser(), rcode %d\n",rcode); } } } else { /* F_OK */ if ( (status=chsuser(uid,gid,host,&rcode,"FTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"WTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"XTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"OPENTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"STATTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"POPENTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"LINKTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"CHMODTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"CHOWNTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"MKDIRTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RMDIRTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RENAMETRUST")) < 0 ) { if (status == -2) log(LOG_ERR,"raccess(): uid %d not allowed to do access(F_OK)\n",uid); else log(LOG_ERR,"raccess(): failed at chsuser(), rcode %d\n",rcode); } } if (status) { status = rcode; } else { status= ( access(filename, mode) < 0 ) ? errno : 0 ; } } } log(LOG_INFO,"raccess: filename: %s, mode %d for (%d,%d) status %d\n",filename,mode,uid,gid,status) ; } p = rqstbuf ; /* * Bug #2646. This is one of the rare cases when the errno * is returned in the status parameter. */ if ( status == -1 && rcode > 0 ) status = rcode; marshall_LONG(p, status); #if defined(SACCT) rfioacct(RQST_ACCESS,uid,gid,s,0,(int)mode,status,errno,NULL,filename,NULL); #endif /* SACCT */ log(LOG_DEBUG, "raccess: sending back %d\n", status); serrno = 0; if (netwrite_timeout(s,rqstbuf,LONGSIZE,RFIO_CTRL_TIMEOUT) != LONGSIZE) { log(LOG_ERR, "raccess: netwrite_timeout(): %s\n", neterror()); return -1 ; } return 0 ; } #endif /* !WIN32 */ int srstatfs(s) int s; { int status = 0 ; int rcode = 0; int len ; char *p ; char path[MAXFILENAMSIZE] ; struct rfstatfs statfsbuf ; int uid, gid; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif memset(&statfsbuf, 0, sizeof(struct rfstatfs)); p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p,len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { log(LOG_DEBUG,"srstatfs(): reading %d bytes\n",len) ; serrno = 0; if ((status = netread_timeout(s,rqstbuf,len,RFIO_CTRL_TIMEOUT)) != len) { log(LOG_ERR,"srstatfs(): read(): %s\n", neterror()); return -1; } p= rqstbuf ; *path = '\0'; if (unmarshall_STRINGN(p, path, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } get_client_actual_id(&uid, &gid, NULL, NULL, NULL, NULL); if ( !status && (uid == -1 || gid == -1)) { status = -1; rcode = EACCES; } if ( !status ) { status = rfstatfs(path,&statfsbuf) ; rcode = errno ; log(LOG_INFO,"srrstatfs: path : %s , status %d\n",path,status ) ; } /* * Shipping the results */ } p = rqstbuf ; marshall_LONG( p, statfsbuf.bsize ) ; marshall_LONG( p, statfsbuf.totblks ) ; marshall_LONG( p, statfsbuf.freeblks ) ; marshall_LONG( p, statfsbuf.totnods ) ; marshall_LONG( p, statfsbuf.freenods ) ; marshall_LONG( p, status ) ; marshall_LONG( p, rcode ) ; log(LOG_DEBUG, "srstatfs: sending back %d\n", status); serrno = 0; if (netwrite_timeout(s,rqstbuf,7*LONGSIZE,RFIO_CTRL_TIMEOUT) != (7*LONGSIZE)) { log(LOG_ERR, "srstatfs: netwrite_timeout(): %s\n", neterror()); return -1 ; } return status ; } int sropen(s,rt,host,bet) SOCKET s; int rt; /* Is it a remote site call ? */ char *host; /* Where the request comes from */ int bet ; /* Version indicator: 0(old) or 1(new) */ { char *auth_id; char *mech; int status; int rcode = 0; char *p; int len; int fd = -1; LONG flags, mode; int uid,gid; WORD mask, ftype, passwd, mapping; char account[MAXACCTSIZE]; /* account string */ char user[CA_MAXUSRNAMELEN+1]; /* User name */ char reqhost[MAXHOSTNAMELEN]; char vmstr[MAXVMSTRING]; SOCKET sock; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p = rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p, len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { /* * Reading open request. */ log(LOG_DEBUG,"ropen: reading %d bytes\n",len) ; memset(rqstbuf,'\0',BUFSIZ); serrno = 0; if ((status = netread_timeout(s,rqstbuf,len,RFIO_CTRL_TIMEOUT)) != len) { log(LOG_ERR,"ropen: read(): %s\n", neterror()); return -1 ; } status = 0; p= rqstbuf ; unmarshall_WORD(p, uid); unmarshall_WORD(p, gid); unmarshall_WORD(p, mask); unmarshall_WORD(p, ftype); unmarshall_LONG(p, flags); unmarshall_LONG(p, mode); *account = *filename = *user = *reqhost = *vmstr = '\0'; if (unmarshall_STRINGN(p, account, MAXACCTSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } if (unmarshall_STRINGN(p, filename, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } if (bet) { if (unmarshall_STRINGN(p, user, CA_MAXUSRNAMELEN+1) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } if (unmarshall_STRINGN(p, reqhost, MAXHOSTNAMELEN) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } unmarshall_LONG(p, passwd); unmarshall_WORD(p, mapping); if (unmarshall_STRINGN(p, vmstr, sizeof(vmstr)) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } } log(LOG_DEBUG,"vms string is %s\n", vmstr) ; get_client_actual_id(&uid, &gid, &mech, &auth_id, &rt, &mapping); if (bet) log(LOG_DEBUG,"Opening file %s for remote user: %s\n",filename,user); if (rt) log(LOG_DEBUG,"Mapping : %s\n",mapping ? "yes" : "no" ); if (rt && !mapping) { log(LOG_DEBUG,"passwd : %d\n",passwd); log(LOG_DEBUG,"uid: %d\n",uid ); log(LOG_DEBUG,"gid: %d\n",gid ); } /* * Someone in the site has tried to specify (uid,gid) directly ! */ if ( (status == 0) && bet && !mapping && !rt) { log(LOG_INFO,"attempt to make non-mapped I/O and modify uid or gid !\n"); errno=EACCES ; rcode=errno ; status= -1 ; } if ( rt ) { openlog("rfio",LOG_PID, LOG_USER) ; syslog(LOG_ALERT, "rfio: connection %s mapping by %s(%d,%d) from %s",(mapping ? "with" : "without"),user,uid,gid,host) ; closelog() ; } /* * MAPPED mode: user will be mapped to user "to" */ if ( !status && rt && mapping ) { char to[100]; int rcd,to_uid,to_gid; log(LOG_DEBUG,"Mapping (%s, %d, %d) \n",user, uid, gid ); if ( (rcd = get_user(host,user,uid,gid,to,&to_uid,&to_gid)) == -ENOENT ) { log(LOG_ERR,"sropen(): get_user() error opening mapping file\n") ; status = -1; errno = EINVAL; rcode = SEHOSTREFUSED ; } else if ( abs(rcd) == 1 ) { log(LOG_ERR,"No entry found in mapping file for (%s,%s,%d,%d)\n", host,user,uid,gid); status = -1; errno = EACCES; rcode = SEHOSTREFUSED; } else { log(LOG_DEBUG,"(%s,%s,%d,%d) mapped to %s(%d,%d)\n", host,user,uid,gid,to,to_uid,to_gid) ; uid = to_uid ; gid = to_gid ; if ( uid < 100 || gid < 100 ) { errno = EACCES; status = -1; rcode = SEHOSTREFUSED; } } } /* * DIRECT access: the user specifies uid & gid by himself */ if ( !status && rt && !mapping ){ char * rtuser; if ( (rtuser=getconfent ("RTUSER","CHECK",0) ) == NULL || ! strcmp (rtuser,"YES") ) { /* Port is also passwd */ #if defined(_WIN32) if( (sock = connecttpread(reqhost, passwd)) != INVALID_SOCKET && !checkkey(sock, passwd) ) #else if( (sock = connecttpread(reqhost, passwd)) >= 0 && !checkkey(sock, passwd) ) #endif { status= -1 ; errno = EACCES; rcode= errno ; log(LOG_ERR,"ropen: DIRECT mapping : permission denied\n"); } #if defined(_WIN32) if( sock == INVALID_SOCKET ) #else if( sock < 0 ) #endif { status= -1 ; log(LOG_ERR,"ropen: DIRECT mapping failed: Couldn't connect %s\n", reqhost); rcode = EACCES; } } else log(LOG_INFO ,"Any DIRECT rfio request from out of site is authorized\n"); } if ( !status ) { int need_user_check = 1; char *pfn = NULL; log(LOG_DEBUG, "ropen: uid %d gid %d mask %o ftype %d flags %d mode %d\n",uid, gid, mask, ftype, flags, mode); log(LOG_DEBUG, "ropen: account: %s\n", account); log(LOG_DEBUG, "ropen: filename: %s\n", filename); log(LOG_INFO, "ropen(%s,0X%X,0X%X) for (%d,%d)\n",filename,flags,mode,uid,gid); status = rfio_handle_open(filename, ntohopnflg(flags), mode, mech, auth_id, uid, gid, &pfn, &handler_context, &need_user_check); if (status < 0) { char alarmbuf[1024]; rcode = serrno; sprintf(alarmbuf,"sropen(): %s",filename) ; log(LOG_DEBUG, "sropen: rfio_handler_open refused open: %s\n", sstrerror(serrno)) ; rfio_alrm(rcode,alarmbuf) ; } if (! status && need_user_check && ((status=chsuser(uid,gid,host,&rcode,((ntohopnflg(flags) & (O_WRONLY|O_RDWR)) != 0) ? "WTRUST" : "RTRUST")) < 0) && ((status=chsuser(uid,gid,host,&rcode,"OPENTRUST")) < 0) ) { if (status == -2) log(LOG_ERR,"ropen(): uid %d not allowed to open()\n",uid); else log(LOG_ERR,"ropen(): failed at chsuser(), rcode %d\n",rcode); status = -1 ; } if (! status) { if (! need_user_check) { /* managed file */ mode = 0660; (void) umask(0) ; } else (void) umask(mask) ; fd = open(filename, ntohopnflg(flags), mode) ; log(LOG_DEBUG, "ropen: open(%s,%d,%d) returned %x (hex)\n", filename, flags, mode, fd); if (fd < 0) { char alarmbuf[1024]; sprintf(alarmbuf,"sropen(): %s",filename) ; status= -1 ; rcode= errno ; log(LOG_DEBUG,"ropen: open: %s\n",strerror(errno)) ; rfio_alrm(rcode,alarmbuf) ; } else { if (! need_user_check && (ntohopnflg(flags) & O_CREAT)) /* new managed file */ chown(filename, stagersuperuser.pw_uid, stagersuperuser.pw_gid); /* * Getting current offset */ status= lseek(fd,0L,SEEK_CUR) ; log(LOG_DEBUG,"ropen: lseek(%d,0,SEEK_CUR) returned %x (hex)\n",fd,status) ; if ( status < 0 ) rcode= errno ; } } if (pfn != NULL) free(pfn); } } /* * Sending back status. */ p= rqstbuf ; marshall_WORD(p,RQST_OPEN) ; marshall_LONG(p,status); marshall_LONG(p,rcode) ; marshall_LONG(p,0) ; #if defined(SACCT) rfioacct(RQST_OPEN,uid,gid,s,(int)ntohopnflg(flags),(int)mode,status,rcode,NULL,filename,NULL); #endif /* SACCT */ log(LOG_DEBUG, "ropen: sending back status(%d) and errno(%d)\n",status,rcode); serrno = 0; if (netwrite_timeout(s,rqstbuf,WORDSIZE+3*LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+3*LONGSIZE)) { log(LOG_ERR,"ropen: netwrite_timeout(): %s\n", neterror()); return -1 ; } return fd ; } int srwrite(s, infop, fd) SOCKET s; int fd; struct rfiostat * infop ; { int status; /* Return code */ int rcode; /* To send back errno */ int how; /* lseek mode */ int offset; /* lseek offset */ int size; /* Requeste write size */ char *p; /* Pointer to buffer */ #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif /* * Receiving request, */ log(LOG_DEBUG, "rwrite(%d, %d)\n",s, fd); p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p, size); unmarshall_LONG(p,how) ; unmarshall_LONG(p,offset) ; log(LOG_DEBUG, "rwrite(%d, %d): size %d, how %d offset %d\n",s,fd,size,how,offset); /* * Checking if buffer is large enough. */ if (iobufsiz < size) { int optval ; /* setsockopt opt value */ if (iobufsiz > 0) { log(LOG_DEBUG, "rwrite(): freeing %x\n",iobuffer); (void) free(iobuffer) ; } if ((iobuffer = malloc(size)) == NULL) { status= -1 ; rcode= errno ; p= rqstbuf ; marshall_WORD(p,RQST_WRITE) ; marshall_LONG(p,status) ; marshall_LONG(p,rcode) ; marshall_LONG(p,0) ; log(LOG_ERR, "rwrite: malloc(): %s\n", strerror(errno)) ; serrno = 0; if ( netwrite_timeout(s,rqstbuf,WORDSIZE+3*LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+3*LONGSIZE) ) { log(LOG_ERR, "rwrite: netwrite_timeout(): %s\n", neterror()); return -1 ; } return -1 ; } iobufsiz = size ; optval = (iobufsiz > 64 * 1024) ? iobufsiz : (64 * 1024); log(LOG_DEBUG, "rwrite(): allocated %d bytes at %x\n",size,iobuffer) ; serrno = 0; if( setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char*)&optval, sizeof(optval)) == SOCKET_ERROR ) log(LOG_ERR, "rwrite(): setsockopt(SO_RCVBUF): %s\n", neterror()); else log(LOG_DEBUG, "rwrite(): setsockopt(SO_RCVBUF): %d\n",optval) ; } /* * Reading data on the network. */ p= iobuffer; serrno = 0; if (netread_timeout(s,p,size,RFIO_DATA_TIMEOUT) != size) { log(LOG_ERR, "rwrite: read(): %s\n", neterror()); return -1 ; } /* * lseek() if needed. */ if ( how != -1 ) { log(LOG_DEBUG,"rwrite(%d,%d): lseek(%d,%d,%d)\n",s,fd,fd,offset,how) ; infop->seekop++; if ( (status= lseek(fd,offset,how)) == -1 ) { rcode= errno ; p= rqstbuf ; marshall_WORD(p,RQST_WRITE) ; marshall_LONG(p,status) ; marshall_LONG(p,rcode) ; marshall_LONG(p,0) ; serrno = 0; if ( netwrite_timeout(s,rqstbuf,WORDSIZE+3*LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+3*LONGSIZE) ) { log(LOG_ERR, "rwrite: netwrite_timeout(): %s\n", neterror()); return -1 ; } return -1 ; } } /* * Writing data on disk. */ infop->wnbr+= size ; status = write(fd,p,size) ; rcode= ( status < 0 ) ? errno : 0 ; if ( status < 0 ) { char alarmbuf[1024]; sprintf(alarmbuf,"srwrite(): %s",filename) ; rfio_alrm(rcode,alarmbuf) ; } p = rqstbuf; marshall_WORD(p,RQST_WRITE) ; marshall_LONG(p,status) ; marshall_LONG(p,rcode) ; marshall_LONG(p,0) ; log(LOG_DEBUG, "rwrite: status %d, rcode %d\n", status, rcode) ; serrno = 0; if (netwrite_timeout(s,rqstbuf,WORDSIZE+3*LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+3*LONGSIZE)) { log(LOG_ERR, "rwrite: netwrite_timeout(): %s\n", neterror()); return -1 ; } return status ; } int srread(s, infop, fd) SOCKET s; int fd; struct rfiostat * infop ; { int status ; /* Return code */ int rcode ; /* To send back errno */ int how ; /* lseek mode */ int offset ; /* lseek offset */ int size ; /* Requested read size */ char *p ; /* Pointer to buffer */ int msgsiz ; /* Message size */ #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif /* * Receiving request. */ log(LOG_DEBUG, "rread(%d, %d)\n",s, fd); p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p, size) ; unmarshall_LONG(p,how) ; unmarshall_LONG(p,offset) ; /* * lseek() if needed. */ if ( how != -1 ) { log(LOG_DEBUG,"rread(%d,%d): lseek(%d,%d,%d)\n",s,fd,fd,offset,how) ; infop->seekop++; if ( (status= lseek(fd,offset,how)) == -1 ) { rcode= errno ; p= rqstbuf ; marshall_WORD(p,RQST_READ) ; marshall_LONG(p,status) ; marshall_LONG(p,rcode) ; marshall_LONG(p,0) ; serrno = 0; if ( netwrite_timeout(s,rqstbuf,WORDSIZE+3*LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+3*LONGSIZE) ) { log(LOG_ERR, "rread: netwrite_timeout(): %s\n", neterror()); return -1 ; } return -1 ; } } /* * Allocating buffer if not large enough. */ log(LOG_DEBUG, "rread(%d, %d): checking buffer size %d\n", s, fd, size); if (iobufsiz < (size+WORDSIZE+3*LONGSIZE)) { int optval ; /* setsockopt opt value */ if (iobufsiz > 0) { log(LOG_DEBUG, "rread(): freeing %x\n",iobuffer); (void) free(iobuffer); } if ((iobuffer = malloc(size+WORDSIZE+3*LONGSIZE)) == NULL) { status= -1 ; rcode= errno ; log(LOG_ERR, "rread: malloc(): %s\n", strerror(errno)) ; p= rqstbuf ; marshall_WORD(p,RQST_READ) ; marshall_LONG(p,status) ; marshall_LONG(p,rcode) ; marshall_LONG(p,0) ; serrno = 0; if ( netwrite_timeout(s,rqstbuf,WORDSIZE+3*LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+3*LONGSIZE) ) { log(LOG_ERR, "rread: netwrite_timeout(): %s\n", neterror()); return -1 ; } return -1 ; } iobufsiz = size + WORDSIZE + 3*LONGSIZE ; log(LOG_DEBUG, "rread(): allocated %d bytes at %x\n",size,iobuffer); optval = (iobufsiz > 64 * 1024) ? iobufsiz : (64 * 1024); serrno = 0; if( setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char*)&optval, sizeof(optval)) == SOCKET_ERROR ) log(LOG_ERR, "rread(): setsockopt(SO_SNDBUF): %s\n", neterror()); else log(LOG_DEBUG, "rread(): setsockopt(SO_SNDBUF): %d\n",optval); } p = iobuffer + WORDSIZE + 3*LONGSIZE; status = read(fd, p, size) ; if ( status < 0 ) { char alarmbuf[1024]; sprintf(alarmbuf,"srread(): %s",filename) ; rcode= errno ; msgsiz= WORDSIZE+3*LONGSIZE ; rfio_alrm(rcode,alarmbuf) ; } else { rcode= 0 ; infop->rnbr+= status ; msgsiz= status+WORDSIZE+3*LONGSIZE ; } p= iobuffer ; marshall_WORD(p,RQST_READ) ; marshall_LONG(p,status) ; marshall_LONG(p,rcode) ; marshall_LONG(p,status) ; log(LOG_DEBUG, "rread: returning status %d, rcode %d\n", status, rcode) ; serrno = 0; if (netwrite_timeout(s,iobuffer,msgsiz,RFIO_CTRL_TIMEOUT) != msgsiz) { log(LOG_ERR, "rread: netwrite_timeout(): %s\n", neterror()); return -1 ; } return status ; } int srreadahead(s, infop, fd) SOCKET s; int fd; struct rfiostat *infop ; { int status; /* Return code */ int rcode; /* To send back errno */ int how; /* lseek mode */ int offset; /* lseek offset */ int size; /* Requested read size */ int first; /* First block sent */ char *p; /* Pointer to buffer */ #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif /* * Receiving request. */ log(LOG_DEBUG, "rreadahead(%d, %d)\n",s, fd); p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p,size); unmarshall_LONG(p,how) ; unmarshall_LONG(p,offset) ; /* * lseek() if needed. */ if ( how != -1 ) { log(LOG_DEBUG,"rread(%d,%d): lseek(%d,%d,%d)\n",s,fd,fd,offset,how) ; infop->seekop++; if ( (status= lseek(fd,offset,how)) == -1 ) { rcode= errno ; p= iobuffer ; marshall_WORD(p,RQST_FIRSTREAD) ; marshall_LONG(p,status) ; marshall_LONG(p,rcode) ; serrno = 0; if ( netwrite_timeout(s,iobuffer,iobufsiz,RFIO_CTRL_TIMEOUT) != iobufsiz ) { log(LOG_ERR, "rreadahead(): netwrite_timeout(): %s\n",neterror()); return -1 ; } return status ; } } /* * Allocating buffer if not large enough. */ log(LOG_DEBUG, "rreadahead(%d, %d): checking buffer size %d\n", s, fd, size); if (iobufsiz < (size+WORDSIZE+3*LONGSIZE)) { int optval ; /* setsockopt opt value */ if (iobufsiz > 0) { log(LOG_DEBUG, "rreadahead(): freeing %x\n",iobuffer); (void) free(iobuffer); } if ((iobuffer = malloc(size+WORDSIZE+3*LONGSIZE)) == NULL) { log(LOG_ERR, "rreadahead: malloc(): %s\n", strerror(errno)) ; (void) close(s) ; return -1 ; } iobufsiz = size+WORDSIZE+3*LONGSIZE ; optval = (iobufsiz > 64 * 1024) ? iobufsiz : (64 * 1024); log(LOG_DEBUG, "rreadahead(): allocated %d bytes at %x\n",iobufsiz,iobuffer); serrno = 0; if( setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char*)&optval, sizeof(optval)) == SOCKET_ERROR ) log(LOG_ERR, "rreadahead(): setsockopt(SO_SNDBUF): %s\n", neterror()); else log(LOG_DEBUG, "rreadahead(): setsockopt(SO_SNDBUF): %d\n",optval) ; } /* * Reading data and sending it. */ for(first= 1;;first= 0) { fd_set fds ; struct timeval timeout ; /* * Has a new request arrived ? */ FD_ZERO(&fds) ; FD_SET(s,&fds) ; timeout.tv_sec = 0 ; timeout.tv_usec= 0 ; serrno = 0; if( select(FD_SETSIZE, &fds, (fd_set*)0, (fd_set*)0, &timeout) == SOCKET_ERROR ) { log(LOG_ERR,"rreadahead(): select(): %s\n", neterror()); return -1; } if ( FD_ISSET(s,&fds) ) { log(LOG_DEBUG,"rreadahead(): returns because of new request\n") ; return 0 ; } /* * Reading disk ... */ p= iobuffer + WORDSIZE + 3*LONGSIZE ; status = read(fd,p,size); if (status < 0) { rcode= errno ; iobufsiz= WORDSIZE+3*LONGSIZE ; } else { rcode= 0 ; infop->rnbr+= status ; iobufsiz = status+WORDSIZE+3*LONGSIZE ; } log(LOG_DEBUG, "rreadahead: status %d, rcode %d\n", status, rcode); /* * Sending data. */ p= iobuffer ; marshall_WORD(p,(first)?RQST_FIRSTREAD:RQST_READAHEAD) ; marshall_LONG(p,status) ; marshall_LONG(p, rcode) ; marshall_LONG(p, status) ; serrno = 0; if ( netwrite_timeout(s, iobuffer, iobufsiz, RFIO_CTRL_TIMEOUT) != iobufsiz ) { log(LOG_ERR, "rreadahead(): netwrite_timeout(): %s\n", neterror()); return -1 ; } /* * The end of file has been reached * or an error was encountered. */ if ( status != size ) { return 0 ; } } } int srclose(s, infop, fd) SOCKET s; int fd; struct rfiostat * infop ; { int status ; int rcode ; char * p ; char tmpbuf[21], tmpbuf2[21]; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif log(LOG_INFO,"rclose(%d,%d): %d read, %d readahead, %d write, %d flush, %d stat, %d lseek and %d preseek\n", s, fd, infop->readop, infop->aheadop, infop->writop, infop->flusop, infop->statop, infop->seekop, infop->presop) ; log(LOG_INFO,"rclose(%d,%d): %s bytes read and %s bytes written\n", s, fd, u64tostr(infop->rnbr,tmpbuf,0), u64tostr(infop->wnbr,tmpbuf2,0)) ; status = close(fd); rcode = ( status < 0 ) ? errno : 0 ; if (iobufsiz > 0) { log(LOG_DEBUG,"rclose(): freeing %x\n",iobuffer) ; (void) free(iobuffer); } iobufsiz= 0 ; p= rqstbuf ; marshall_WORD(p,RQST_CLOSE) ; marshall_LONG(p,status) ; marshall_LONG(p,rcode) ; marshall_LONG(p,0) ; #if defined(SACCT) rfioacct(RQST_CLOSE,0,0,s,0,0,status,rcode,infop,NULL,NULL); #endif /* SACCT */ serrno = 0; if (netwrite_timeout(s,rqstbuf,WORDSIZE+3*LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+3*LONGSIZE)) { log(LOG_ERR, "rclose: netwrite_timeout(): %s\n", neterror()); return -1 ; } return status ; } int srpclose(s, fs) SOCKET s; FILE *fs; { int status; char *p; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif errno = 0; #if defined(_WIN32) status = _pclose(fs); #else status = pclose(fs); #endif log(LOG_DEBUG,"rpclose(%x) returns %d\n",fs,status) ; /* * status returns the command's error code */ p= rqstbuf ; marshall_LONG(p,status) ; marshall_LONG(p,errno) ; #if defined(SACCT) rfioacct(RQST_PCLOSE,0,0,s,0,0,status,errno,NULL,NULL,NULL); #endif /* SACCT */ serrno = 0; if (netwrite_timeout(s,rqstbuf,2*LONGSIZE,RFIO_CTRL_TIMEOUT) != (2*LONGSIZE)) { log(LOG_ERR, "rpclose: netwrite_timeout(): %s\n", neterror()); return -1 ; } return status ; } FILE *srpopen(s, host, rt) SOCKET s; char *host; int rt; { int status = 0; int rcode = 0; int uid, gid; char *p; int len; char type[5]; char command[MAXCOMSIZ]; char username[CA_MAXUSRNAMELEN+1]; FILE *fs = NULL; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif log(LOG_DEBUG, "srpopen(%d,%s,%d)\n",s,host,rt) ; p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p ,len ); if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { serrno = 0; if (netread_timeout(s,rqstbuf,len,RFIO_CTRL_TIMEOUT) != len) { log(LOG_ERR,"rpopen: read(): %s\n",neterror()) ; return NULL ; } p= rqstbuf ; unmarshall_WORD(p, uid); unmarshall_WORD(p, gid); get_client_actual_id(&uid, &gid, NULL, NULL, &rt, NULL); if (unmarshall_STRINGN(p, type, sizeof(type)) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } if (unmarshall_STRINGN(p, command, MAXCOMSIZ) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } if (unmarshall_STRINGN(p, username, CA_MAXUSRNAMELEN+1) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } log(LOG_DEBUG,"requestor is (%s, %d, %d) \n",username, uid, gid ); if (!status) { log(LOG_ERR,"srpopen(): Denying popen request (%s, %d, %d) from %s for command %s\n", username, uid, gid, host, command); status = -1; rcode = errno = EACCES; } } p= rqstbuf ; #if defined(SACCT) rfioacct(RQST_POPEN,uid,gid,s,0,0,status,rcode,NULL,command,NULL); #endif /* SACCT */ log(LOG_DEBUG, "rpopen: sending back status(%d) and rcode(%d)\n",status, rcode) ; marshall_LONG( p, status ) ; marshall_WORD( p, rcode ) ; serrno = 0; if (netwrite_timeout(s,rqstbuf,WORDSIZE+LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+LONGSIZE)) { log(LOG_ERR,"rpopen(): netwrite_timeout(): %s\n", neterror()); return NULL ; } return fs ; } int srfread(s, fp) SOCKET s; FILE *fp; { int status = 0; int rcode = 0; int size, items; char *p; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p = rqstbuf +2*WORDSIZE ; log(LOG_DEBUG, "rfread(%x)\n",fp); unmarshall_LONG(p, size); unmarshall_LONG(p, items); log(LOG_DEBUG,"rfread(%d, %x): size %d items %d\n", s, fp, size, items); if (iobufsiz < items*size) { if (iobufsiz > 0) { log(LOG_DEBUG, "rfread(): freeing %x\n",iobuffer); (void) free(iobuffer); } if ((iobuffer = malloc(items*size)) == NULL) { log(LOG_ERR, "rfread: malloc(): %s\n", strerror(errno)); return(-1); } iobufsiz = items*size; log(LOG_DEBUG, "rfread(): allocated %d bytes at %x\n",items*size,iobuffer); } errno = 0 ; status = fread(iobuffer, size, items, fp) ; if ( status == 0 ) { rcode= errno ; } log(LOG_DEBUG, "rfread : status %d, rcode %d\n", status, rcode); p = rqstbuf; marshall_LONG(p, status); marshall_LONG(p, rcode); serrno = 0; if (netwrite_timeout(s, rqstbuf, 2*LONGSIZE, RFIO_CTRL_TIMEOUT) != (2*LONGSIZE)) { log(LOG_ERR, "rfread : netwrite_timeout(): %s\n", neterror()); return(-1); } if ( status > 0 ) { serrno = 0; if (netwrite_timeout(s,iobuffer, status*size, RFIO_CTRL_TIMEOUT) != (status*size)) { log(LOG_ERR, "rfread: netwrite_timeout(): %s\n", neterror()); return(-1); } } return(status); } int srfwrite(s, fp) SOCKET s; FILE *fp; { int status = 0; int rcode = 0; int size, items; char *ptr; char *p = rqstbuf; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p = rqstbuf +2*WORDSIZE ; log(LOG_DEBUG, "rfwrite(%x)\n",fp); unmarshall_LONG(p, size); unmarshall_LONG(p, items); log(LOG_DEBUG, "rfwrite(%d,%x): size %d items %d\n",s,fp,size,items); if (iobufsiz < items*size) { if (iobufsiz > 0) { log(LOG_DEBUG, "rfwrite(): freeing %x\n",iobuffer); (void) free(iobuffer); } if ((iobuffer = malloc(items*size)) == NULL) { log(LOG_ERR, "rfwrite: malloc(): %s\n", strerror(errno)); return(-1); } iobufsiz = items*size; log(LOG_DEBUG, "rfwrite(): allocated %d bytes at %x\n",items*size,iobuffer); } ptr = iobuffer; log(LOG_DEBUG, "rfwrite: reading %d bytes\n",items*size) ; serrno = 0; if (netread_timeout(s, iobuffer, items*size, RFIO_CTRL_TIMEOUT) != (items*size)) { log(LOG_ERR, "rfwrite: netread(): %s\n", neterror()); return(-1); } if ( (status = fwrite( ptr, size, items, fp)) == 0 ) rcode= errno ; log(LOG_DEBUG, "rfwrite: status %d, rcode %d\n", status, rcode); p = rqstbuf; marshall_LONG(p, status); marshall_LONG(p, rcode); serrno = 0; if (netwrite_timeout(s, rqstbuf, 2*LONGSIZE, RFIO_CTRL_TIMEOUT) != (2*LONGSIZE)) { log(LOG_ERR, "rfwrite: netwrite_timeout(): %s\n", neterror()); return(-1); } return(status); } int srfstat(s, infop, fd) SOCKET s; int fd; struct rfiostat *infop; { int status; int rcode; int msgsiz; int how; int offset; char *p; struct stat statbuf; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif log(LOG_DEBUG, "rfstat(%d, %d)\n",s,fd) ; p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p,offset) ; unmarshall_LONG(p,how) ; /* * lseek() if needed. */ if ( how != -1 ) { log(LOG_DEBUG,"rfstat(%d,%d): lseek(%d,%d,%d)\n",s,fd,fd,offset,how) ; if ( (status= lseek(fd,offset,how)) == -1 ) { rcode= errno ; p= rqstbuf ; marshall_WORD(p,RQST_FSTAT) ; marshall_LONG(p,status) ; marshall_LONG(p,rcode) ; serrno = 0; if ( netwrite_timeout(s,rqstbuf,6*LONGSIZE+6*WORDSIZE,RFIO_CTRL_TIMEOUT) != (6*LONGSIZE+6*WORDSIZE) ) { log(LOG_ERR, "rfstat(): netwrite_timeout(): %s\n", neterror()); return -1 ; } return status ; } } /* * Issuing the fstat() */ status= fstat(fd, &statbuf) ; rcode= errno ; msgsiz= 5*WORDSIZE + 5*LONGSIZE ; p = rqstbuf; marshall_WORD(p, RQST_FSTAT) ; marshall_LONG(p, status) ; marshall_LONG(p, rcode) ; marshall_LONG(p, msgsiz) ; marshall_WORD(p, statbuf.st_dev); marshall_LONG(p, statbuf.st_ino); marshall_WORD(p, statbuf.st_mode); marshall_WORD(p, statbuf.st_nlink); marshall_WORD(p, statbuf.st_uid); marshall_WORD(p, statbuf.st_gid); marshall_LONG(p, statbuf.st_size); marshall_LONG(p, statbuf.st_atime); marshall_LONG(p, statbuf.st_mtime); marshall_LONG(p, statbuf.st_ctime); log(LOG_DEBUG, "rfstat: sending back %d\n",status) ; serrno = 0; if (netwrite_timeout(s,rqstbuf,8*LONGSIZE+6*WORDSIZE,RFIO_CTRL_TIMEOUT) != (8*LONGSIZE+6*WORDSIZE)) { log(LOG_ERR,"rfstat: netwrite_timeout(): %s\n", neterror()); return -1 ; } return 0 ; } int srlseek(s, infop, fd) SOCKET s; int fd; struct rfiostat *infop; { int status; int rcode; int offset; int how; char *p; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p,offset) ; unmarshall_LONG(p,how) ; log(LOG_DEBUG,"rlseek(%d, %d): offset %d, how: %x\n",s,fd,offset,how) ; status = lseek(fd, offset, how) ; rcode= ( status < 0 ) ? errno : 0 ; log(LOG_DEBUG,"rlseek: status %d, rcode %d\n",status,rcode) ; p= rqstbuf ; marshall_WORD(p,RQST_LSEEK) ; marshall_LONG(p,status) ; marshall_LONG(p,rcode) ; marshall_LONG(p,0) ; serrno = 0; if (netwrite_timeout(s,rqstbuf,WORDSIZE+3*LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+3*LONGSIZE)) { log(LOG_ERR,"rlseek: netwrite_timeout(): %s\n", neterror()) ; return -1 ; } return status ; } int srpreseek(s, infop, fd) SOCKET s; int fd; struct rfiostat *infop; { int status; /* Return code */ int size; /* Buffer size */ int nblock; /* Nb of blocks to read */ int first; /* First block sent */ char *p; /* Pointer to buffer */ int reqno; /* Request number */ struct iovec *v; /* List of requests */ char *trp = NULL; /* Temporary buffer */ #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p,size) ; unmarshall_LONG(p,nblock) ; log(LOG_DEBUG,"rpreseek(%d, %d)\n",s,fd) ; /* * A temporary buffer may need to be created * to receive the request. */ if ( nblock*2*LONGSIZE > BUFSIZ ) { if ( (trp= (char *) malloc(nblock*2*LONGSIZE)) == NULL ) { return -1 ; } } p= ( trp ) ? trp : rqstbuf ; /* * Receiving the request. */ log(LOG_DEBUG,"rpreseek: reading %d bytes\n",nblock*2*LONGSIZE) ; serrno = 0; if ( netread_timeout(s,p,nblock*2*LONGSIZE,RFIO_CTRL_TIMEOUT) != (nblock*2*LONGSIZE) ) { log(LOG_ERR,"rpreseek: netread(): %s\n", neterror()); if ( trp ) (void) free(trp) ; return -1 ; } /* * Allocating space for the list of requests. */ if ( (v= ( struct iovec *) malloc(nblock*sizeof(struct iovec))) == NULL ) { log(LOG_ERR, "rpreseek: malloc(): %s\n",strerror(errno)) ; if ( trp ) (void) free(trp) ; (void) close(s) ; return -1 ; } /* * Filling list request. */ for(reqno= 0;reqno 0) { log(LOG_DEBUG, "rpreseek(): freeing %x\n",iobuffer); (void) free(iobuffer); } if ((iobuffer = malloc(size+WORDSIZE+3*LONGSIZE)) == NULL) { log(LOG_ERR, "rpreseek: malloc(): %s\n", strerror(errno)) ; (void) close(s) ; return -1 ; } iobufsiz = size+WORDSIZE+3*LONGSIZE ; optval = (iobufsiz > 64 * 1024) ? iobufsiz : (64 * 1024); log(LOG_DEBUG, "rpreseek(): allocated %d bytes at %x\n",iobufsiz,iobuffer) ; serrno = 0; if( setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char*)&optval, sizeof(optval)) == SOCKET_ERROR ) log(LOG_ERR, "rpreseek(): setsockopt(SO_SNDBUF): %s\n", neterror()); else log(LOG_DEBUG, "rpreseek(): setsockopt(SO_SNDBUF): %d\n",optval) ; } /* * Reading data and sending it. */ reqno= 0 ; for(first= 1;;first= 0) { struct timeval timeout ; fd_set fds ; int nbfree ; int nb ; /* * Has a new request arrived ? * The preseek is then interrupted. */ FD_ZERO(&fds) ; FD_SET(s,&fds) ; timeout.tv_sec = 0 ; timeout.tv_usec= 0 ; serrno = 0; if( select(FD_SETSIZE, &fds, (fd_set*)0, (fd_set*)0, &timeout) == SOCKET_ERROR ) { log(LOG_ERR,"rpreseek(): select(): %s\n", neterror()); return -1; } if ( FD_ISSET(s,&fds) ) { log(LOG_DEBUG,"rpreseek(): returns because of new request\n") ; return 0 ; } /* * Filling buffer. */ p= iobuffer + WORDSIZE + 3*LONGSIZE ; for(nb= 0, nbfree= size; 4*LONGSIZErnbr += status ; nbfree -= status ; p += status ; } } else { /* * The record is broken into two pieces. */ status= read(fd,p+4*LONGSIZE,nbfree) ; marshall_LONG(p,v[reqno].iov_base) ; marshall_LONG(p,nbfree) ; marshall_LONG(p,status) ; marshall_LONG(p,errno) ; if ( status != -1 ) { infop->rnbr += status ; nbfree -= status ; p += status ; #if HPUX1010 || IRIX6 || IRIX5 v[reqno].iov_base = (caddr_t)v[reqno].iov_base + status ; #else v[reqno].iov_base += status ; #endif v[reqno].iov_len -= status ; reqno -- ; } } } p= iobuffer ; if ( first ) { marshall_WORD(p,RQST_FIRSTSEEK) ; } else { marshall_WORD(p,(reqno == nblock) ? RQST_LASTSEEK:RQST_PRESEEK) ; } marshall_LONG(p,nb) ; marshall_LONG(p,0) ; marshall_LONG(p,size) ; log(LOG_DEBUG,"rpreseek(): sending %d bytes\n",iobufsiz) ; serrno = 0; if ( netwrite_timeout(s,iobuffer,iobufsiz,RFIO_CTRL_TIMEOUT) != iobufsiz ) { log(LOG_ERR, "rpreseek(): netwrite_timeout(): %s\n", neterror()); return -1 ; } /* * All the data needed has been * sent over the network. */ if ( reqno == nblock ) return 0 ; } } #if !defined(_WIN32) int srfchmod(s, host, rt, fd) int s; char *host; int rt; int fd; { int status; int rcode; int mode; char *p; int uid; log(LOG_DEBUG, "rfchmod(%d, %d)\n",s,fd) ; /* fchmod() is not for remote users */ if ( rt ) { status = -1; rcode = EACCES ; log(LOG_ERR,"Attempt to srfchmod() from %s denied\n",host); } else { uid = getuid(); if ( ((status=chksuser(uid,0,host,&rcode,"WTRUST")) < 0) && ((status=chksuser(uid,0,host,&rcode,"CHMODTRUST")) < 0) ) { log(LOG_ERR,"srchmod(): UID %d not allowed to chmod()\n",uid); } else { p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p,mode) ; log(LOG_INFO,"chmod: filedesc: %d, mode: %o\n", fd, mode) ; /* * Issuing the fchmod() */ status= fchmod(fd, mode) ; rcode= errno ; } } p = rqstbuf; marshall_WORD(p, RQST_FCHMOD) ; marshall_LONG(p, status) ; marshall_LONG(p, rcode) ; marshall_LONG(p, 0) ; log(LOG_DEBUG, "rfchmod: sending back %d\n",status) ; serrno = 0; if (netwrite_timeout(s,rqstbuf,3*LONGSIZE+1*WORDSIZE,RFIO_CTRL_TIMEOUT) != (3*LONGSIZE+1*WORDSIZE)) { log(LOG_ERR,"rfchmod: netwrite_timeout(): %s\n",neterror()); return -1 ; } return 0 ; } int srfchown(s, host, rt, fd) int s; char *host; int rt; int fd; { int status; int rcode; int owner; int group; char *p; int uid; log(LOG_DEBUG, "rfchown(%d, %d)\n",s,fd) ; /* fchown() is not for remote users */ if ( rt ) { status = -1; rcode = EACCES ; log(LOG_ERR,"Attempt to srfchown() from %s denied\n",host); } else { uid = getuid(); if ( ((status=chksuser(uid,0,host,&rcode,"WTRUST")) < 0) && ((status=chksuser(uid,0,host,&rcode,"CHOWNTRUST")) < 0) ) { log(LOG_ERR,"srfchown(): UID %d not allowed to chown()\n",uid); } else { p= rqstbuf + 2*WORDSIZE ; unmarshall_WORD(p,owner) ; unmarshall_WORD(p,group) ; log(LOG_INFO,"rfchown: filedesc: %d, uid: %d ,gid: %d\n",fd,owner,group); /* * Issuing the fchown() */ status= fchown(fd, owner, group) ; rcode= errno ; } } p = rqstbuf; marshall_WORD(p, RQST_FCHOWN) ; marshall_LONG(p, status) ; marshall_LONG(p, rcode) ; marshall_LONG(p, 0) ; log(LOG_DEBUG, "rfchown: sending back %d\n",status) ; serrno = 0; if (netwrite_timeout(s,rqstbuf,3*LONGSIZE+1*WORDSIZE,RFIO_CTRL_TIMEOUT) != (3*LONGSIZE+1*WORDSIZE)) { log(LOG_ERR,"rfchown: netwrite_timeout(): %s\n",neterror()); return -1 ; } return 0 ; } #endif /* !WIN32 */ #if !defined(_WIN32) DIR *sropendir(s,rt,host,bet) int s; int rt; char *host; int bet; { int status; int rcode = 0; char *p; int len; int fd; int uid,gid; WORD passwd,mapping; char account[MAXACCTSIZE]; char user[CA_MAXUSRNAMELEN+1]; char reqhost[MAXHOSTNAMELEN]; char vmstr[MAXVMSTRING]; int sock; DIR *dirp; dirp = NULL; p = rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p,len); if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { /* * Read opendir request */ log(LOG_DEBUG,"ropendir: reading %d bytes\n",len); memset(rqstbuf,'\0',BUFSIZ); serrno = 0; if ( (status = netread_timeout(s,rqstbuf,len,RFIO_CTRL_TIMEOUT)) != len ) { log(LOG_ERR,"ropendir: read(): %s\n",neterror()); return(NULL); } status = 0; *account = *filename = *user = *reqhost = *vmstr = '\0'; p = rqstbuf; unmarshall_WORD(p,uid); unmarshall_WORD(p,gid); if (unmarshall_STRINGN(p, account, MAXACCTSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } if (unmarshall_STRINGN(p, filename, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } if (unmarshall_STRINGN(p, user, CA_MAXUSRNAMELEN+1) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } if (unmarshall_STRINGN(p, reqhost, MAXHOSTNAMELEN) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } unmarshall_LONG(p, passwd); unmarshall_WORD(p, mapping); if (unmarshall_STRINGN(p, vmstr, sizeof(vmstr)) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } log(LOG_DEBUG,"vms string is %s\n", vmstr) ; get_client_actual_id(&uid, &gid, NULL, NULL, &rt, &mapping); if (bet) log(LOG_DEBUG,"Opening directory %s for remote user: %s\n",filename,user); if (rt) log(LOG_DEBUG,"Mapping : %s\n",mapping ? "yes" : "no" ); if (rt && !mapping) { log(LOG_DEBUG,"passwd : %d\n",passwd); log(LOG_DEBUG,"uid: %d\n",uid ); log(LOG_DEBUG,"gid: %d\n",gid ); } /* * Someone in the site has tried to specify (uid,gid) directly ! */ if ( (status == 0) && bet && !mapping && !rt) { log(LOG_INFO,"attempt to make non-mapped I/O and modify uid or gid !\n"); errno=EACCES ; rcode=errno ; status= -1 ; } if ( rt ) { openlog("rfio",LOG_PID, LOG_USER) ; syslog(LOG_ALERT, "rfio: connection %s mapping by %s(%d,%d) from %s",(mapping ? "with" : "without"),user,uid,gid,host) ; closelog() ; } /* * MAPPED mode: user will be mapped to user "to" */ if ( !status && rt && mapping ) { char to[100]; int rcd,to_uid,to_gid; log(LOG_DEBUG,"Mapping (%s, %d, %d) \n",user, uid, gid ); if ( (rcd = get_user(host,user,uid,gid,to,&to_uid,&to_gid)) == -ENOENT ) { log(LOG_ERR,"sropendir(): get_user() error opening mapping file\n") ; status = -1; errno = EINVAL; rcode = SEHOSTREFUSED ; } else if ( abs(rcd) == 1 ) { log(LOG_ERR,"No entry found in mapping file for (%s,%s,%d,%d)\n", host,user,uid,gid); status = -1; errno = EACCES; rcode = SEHOSTREFUSED; } else { log(LOG_DEBUG,"(%s,%s,%d,%d) mapped to %s(%d,%d)\n", host,user,uid,gid,to,to_uid,to_gid) ; uid = to_uid ; gid = to_gid ; if ( uid < 100 || gid < 100 ) { errno = EACCES; status = -1; rcode = SEHOSTREFUSED; } } } /* * DIRECT access: the user specifies uid & gid by himself */ if ( !status && rt && !mapping ) { char * rtuser; if ( (rtuser=getconfent ("RTUSER","CHECK",0) ) == NULL || ! strcmp (rtuser,"YES") ) { /* Port is also passwd */ if ((sock=connecttpread(reqhost,passwd))>=0 && !checkkey(sock,passwd)) { status= -1 ; errno = EACCES; rcode= errno ; log(LOG_ERR,"ropendir: DIRECT mapping : permission denied\n"); } if (sock < 0) { status= -1 ; log(LOG_ERR,"ropendir: DIRECT mapping failed: Couldn't connect %s\n",reqhost); rcode = EACCES; } } else log(LOG_INFO ,"Any DIRECT rfio request from out of site is authorized\n"); } if ( !status ) { log(LOG_DEBUG, "ropendir: uid %d gid %d\n",uid, gid); log(LOG_DEBUG, "ropendir: account: %s\n", account); log(LOG_DEBUG, "ropendir: dirname: %s\n", filename); log(LOG_INFO, "ropendir(%s) for (%d,%d)\n",filename,uid,gid); if ( ((status=chsuser(uid,gid,host,&rcode,"RTRUST")) < 0) && ((status=chsuser(uid,gid,host,&rcode,"OPENTRUST")) < 0) ) { if (status == -2) log(LOG_ERR,"ropendir(): uid %d not allowed to open()\n",uid); else log(LOG_ERR,"ropendir(): failed at chsuser(), rcode %d\n",rcode); status = -1 ; } else { dirp= opendir(filename) ; if ( dirp == NULL ) { char alarmbuf[1024]; status= -1 ; rcode= errno ; sprintf(alarmbuf,"sropendir(): %s",filename) ; log(LOG_ERR,"ropendir: opendir: %s\n",strerror(rcode)) ; rfio_alrm(rcode,alarmbuf) ; } log(LOG_DEBUG,"ropendir: opendir(%s) returned %x (hex)\n",filename,dirp) ; } } } /* * Sending back status. */ p = rqstbuf; marshall_WORD(p,RQST_OPENDIR) ; marshall_LONG(p,status); marshall_LONG(p,rcode) ; marshall_LONG(p,0) ; #if defined(SACCT) rfioacct(RQST_OPENDIR,uid,gid,s,0,0,status,rcode,NULL,filename,NULL); #endif /* SACCT */ log(LOG_DEBUG, "ropendir: sending back status(%d) and errno(%d)\n",status,rcode); serrno = 0; if (netwrite_timeout(s,rqstbuf,WORDSIZE+3*LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+3*LONGSIZE)) { log(LOG_ERR,"ropendir: netwrite_timeout(): %s\n",neterror()) ; return NULL ; } return(dirp); } int srreaddir(s, infop, dirp) int s; struct rfiostat * infop; DIR *dirp; { int status ; /* Return code */ int rcode=0 ; /* To send back errno */ int namlen ; /* length of filename */ char * p ; /* Pointer to buffer */ char direntmsg[MAXFILENAMSIZE+WORDSIZE+3*LONGSIZE]; /* Reply msg */ int msgsiz ; /* Message size */ struct dirent *dp = NULL; /* * Receiving request. */ log(LOG_DEBUG, "rreaddir(%d, 0x%x)\n",s, dirp); p= rqstbuf + 2*WORDSIZE ; msgsiz = 0; status = 0; dp = readdir(dirp); if ( dp == NULL ) { rcode = errno; status = -1; } p= direntmsg; if ( dp != NULL && *dp->d_name != '\0' ) { namlen = strlen(dp->d_name); } else { namlen = 0; } marshall_WORD(p,RQST_READDIR); marshall_LONG(p,status); marshall_LONG(p,rcode); marshall_LONG(p,namlen); infop->rnbr+=namlen + WORDSIZE + 3*LONGSIZE; log(LOG_DEBUG, "rreaddir: status %d, rcode %d\n", status, rcode) ; serrno = 0; if (netwrite_timeout(s,direntmsg,WORDSIZE+3*LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+3*LONGSIZE)) { log(LOG_ERR, "rreaddir: netwrite_timeout(): %s\n", neterror()) ; return -1 ; } if ( namlen > 0 ) { marshall_STRING(p,dp->d_name); serrno = 0; if (netwrite_timeout(s,&direntmsg[WORDSIZE+3*LONGSIZE],namlen,RFIO_CTRL_TIMEOUT) != namlen) { log(LOG_ERR, "rreaddir: netwrite_timeout(): %s\n", neterror()) ; return -1 ; } } return status ; } int srrewinddir(s, infop, dirp) int s; struct rfiostat * infop; DIR *dirp; { int status = 0; int rcode = 0; char *p; log(LOG_DEBUG,"rrewinddir(%d,0x%x)\n",s,dirp); if ( dirp != NULL ) { (void)rewinddir(dirp); status = 0; } else { status = -1; rcode = EBADF; } p = rqstbuf; marshall_WORD(p,RQST_REWINDDIR); marshall_LONG(p,status); marshall_LONG(p,rcode); marshall_LONG(p,0); #if defined(SACCT) rfioacct(RQST_REWINDDIR,0,0,s,0,0,status,rcode,infop,NULL,NULL); #endif /* SACCT */ serrno = 0; if (netwrite_timeout(s,rqstbuf,WORDSIZE+3*LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+3*LONGSIZE)) { log(LOG_ERR, "rrewinddir: netwrite_timeout(): %s\n", neterror()); return -1 ; } return status ; } int srclosedir(s,infop,dirp) int s; struct rfiostat * infop; DIR *dirp; { int status = 0; int rcode = 0; char *p; log(LOG_DEBUG,"rclosedir(%d,0x%x)\n",s,dirp); if ( dirp != NULL ) { status = closedir(dirp); } rcode = (status < 0) ? errno : 0; p = rqstbuf; marshall_WORD(p,RQST_CLOSEDIR); marshall_LONG(p,status); marshall_LONG(p,rcode); marshall_LONG(p,0); #if defined(SACCT) rfioacct(RQST_CLOSEDIR,0,0,s,0,0,status,rcode,infop,NULL,NULL); #endif /* SACCT */ serrno = 0; if (netwrite_timeout(s,rqstbuf,WORDSIZE+3*LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+3*LONGSIZE)) { log(LOG_ERR, "rclosedir: netwrite_timeout(): %s\n", neterror()); return -1 ; } return status ; } #endif /* WIN32 */ /* * check if trusted host. */ static int chksuser(uid,gid,hostname,ptrcode,permstr) int uid; /* uid of caller */ int gid; /* gid of caller */ char *hostname ; /* caller's host name */ int *ptrcode ; /* Return code */ char *permstr; /* permission string for the request */ { int found = 0 ; char *cp , *p; char hostname1[MAXHOSTNAMELEN]; int l; if (uid == -1 || gid == -1) { *ptrcode = EACCES; return -1 ; } if ( uid < 100 ) { if ( permstr != NULL && hostname != NULL && (p=getconfent("RFIOD", permstr, 1)) != NULL ) { l = strlen(localdomain); for (cp=strtok(p,"\t ");cp!=NULL;cp=strtok(NULL,"\t ")) { if ( !strcmp(hostname,cp) ) { found ++ ; break ; } if (strchr(cp,'.')) continue; if (strlen(cp)+l+1 > MAXHOSTNAMELEN) continue; sprintf(hostname1,"%s.%s",cp,localdomain); if ( !strcmp(hostname1,hostname) ) { found ++ ; break ; } } } if (!found) { *ptrcode = EACCES ; log(LOG_ERR,"chksuser():uid < 100: No %s.\n",permstr) ; return -1 ; } else log(LOG_INFO, "chksuser():root authorized from %s\n",hostname); } return 0 ; } /* * makes the setgid() and setuid(). Returns -1 if error , -2 if unauthorized. */ int chsuser(uid,gid,hostname,ptrcode,permstr) int uid; /* uid of caller */ int gid; /* gid of caller */ char *hostname ; /* caller's host name */ int *ptrcode ; /* Return code */ char *permstr; /* permission string for the request */ { struct passwd *pw ; if ( chksuser(uid,gid,hostname,ptrcode,permstr) < 0 ) return -2 ; if ( uid >=100 && ( (pw = getpwuid((uid_t)uid)) == NULL #if defined(_WIN32) )) #else || chsgroup(pw,gid)) ) #endif { *ptrcode = EACCES ; log(LOG_ERR,"chsuser(): user (%d,%d) does not exist at local host\n",uid,gid); return -2 ; } /* giving up secondary gruops may fail if we have already given up super user privs */ (void) setgroups(0, NULL); if ( (setgid((gid_t)gid)<0) || (setuid((uid_t)uid)<0) ) { *ptrcode = errno ; log(LOG_ERR,"chsuser(): unable to setuid,gid(%d,%d): %s, we are (uid=%d,gid=%d,euid=%d,egid=%d)\n",uid,gid,strerror(errno),(int) getuid(),(int) getgid(),(int) geteuid(),(int) getegid()) ; return -2 ; } return 0 ; } #if !defined(_WIN32) int chsgroup(pw,gid) struct passwd *pw; int gid; { struct group *gr; char **membername; int rc,found; if ( pw != NULL && pw->pw_gid != (gid_t)gid ) { found = 0; (void) setgrent(); while (gr = getgrent()) { if ( gr->gr_gid != (gid_t)gid ) continue; for ( membername = gr->gr_mem; membername && *membername; membername++ ) if ( !strcmp(*membername,pw->pw_name) ) { found = 1; break; } if ( found ) break; } endgrent(); if ( !found ) return(-1); } else if ( pw == NULL ) return(-1); return(0); } #endif /* WIN32 */ /* Warning : the new sequential transfer mode cannot be used with several files open at a time (because of those global variables)*/ #if !defined(_WIN32) /* moved to global structure */ static int data_sock; /* Data socket */ static int ctrl_sock; /* the control socket */ static int first_write; static int first_read; static int byte_read_from_network; static struct rfiostat myinfo; #endif /* WIN32 */ bind_v3_data_port(char *func, SOCKET data_socket) { char *dp; char *p; int port; int port_max; int port_min; struct sockaddr_storage from; struct addrinfo hints, *ai, *aitop; char strport[NI_MAXSERV]; int gaierrno; #if defined(_AIX) socklen_t fromlen; #else int fromlen; #endif int start_port; int one=1; int af; fromlen = sizeof(from); serrno = 0; if (getsockname(data_socket, (struct sockaddr *)&from, &fromlen)) { log(LOG_ERR, "%s: getsockname(): %s\n", func, neterror()); return(-1); } af = from.ss_family; #ifdef IPV6_V6ONLY if (af == AF_INET6) { (void)setsockopt(data_socket, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&one, sizeof(one)); } #endif memset (&hints, '\0', sizeof(struct addrinfo)); hints.ai_family = af; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; if ((p = getenv ("RFIO_PORT_RANGE"))) { if ((port_min = strtol (p, &dp, 10)) < 0 || (*dp != ' ' && *dp != ',' && *dp != ':')) { log(LOG_ERR, "%s: Invalid RFIO_PORT_RANGE\n", func); return(-1); } if ((port_max = strtol (dp+1, &dp, 10)) < 0 || *dp != '\0') { log(LOG_ERR, "%s: Invalid RFIO_PORT_RANGE\n", func); return(-1); } if (port_min > 65534 || port_max > 65534 || port_min > port_max) { log(LOG_ERR, "%s: Invalid RFIO_PORT_RANGE\n", func); return(-1); } port = start_port = port_min + time(NULL) % (port_max - port_min + 1); while (1) { snprintf (strport, sizeof(strport), "%u", port); gaierrno = Cgetaddrinfo(NULL, strport, &hints, &aitop); if (gaierrno == 0) { ai = aitop; serrno = 0; if(bind(data_socket, ai->ai_addr, ai->ai_addrlen) == 0) { freeaddrinfo(aitop); return (port); } freeaddrinfo(aitop); } port++; if (port > port_max) port = port_min; if (port == start_port) break; } if (gaierrno == 0) log(LOG_ERR, "%s: bind: %s\n", func, neterror()); else log(LOG_ERR, "%s: Cgetaddrinfo: %s\n", func, Cgai_strerror(gaierrno)); return(-1); } gaierrno = Cgetaddrinfo(NULL, "0", &hints, &aitop); if (gaierrno != 0) { log(LOG_ERR, "%s: Cgetaddrinfo: %s\n",func, Cgai_strerror(gaierrno)); return(-1); } ai = aitop; serrno = 0; if( bind(data_socket, ai->ai_addr, ai->ai_addrlen) == SOCKET_ERROR) { log(LOG_ERR, "%s: bind: %s\n", func, neterror()); return(-1); } fromlen = sizeof(from); serrno = 0; if( getsockname(data_socket, (struct sockaddr *)&from, &fromlen) == SOCKET_ERROR ) { log(LOG_ERR, "%s: getsockname: %s\n", func, neterror()); return(-1); } switch(from.ss_family) { case AF_INET: return (ntohs(((struct sockaddr_in *)&from)->sin_port)); case AF_INET6: return (ntohs(((struct sockaddr_in6 *)&from)->sin6_port)); } return (-1); } int sropen_v3(s, rt, host, bet) SOCKET s; int rt; /* Is it a remote site call ? */ char *host; /* Where the request comes from */ int bet; /* Version indicator: 0(old) or 1(new) */ { char *auth_id; char *mech; int status; int rcode = 0; char *p; int len; int fd = -1; LONG flags, mode; int uid,gid; WORD mask, ftype, passwd, mapping; char account[MAXACCTSIZE]; /* account string */ char user[CA_MAXUSRNAMELEN+1]; /* User name */ char reqhost[MAXHOSTNAMELEN]; char vmstr[MAXVMSTRING]; #if defined(_WIN32) SOCKET sock; #else int sock, data_s; #endif int port; #if defined(_AIX) socklen_t fromlen; #else int fromlen; #endif struct sockaddr_storage from; extern int max_rcvbuf; extern int max_sndbuf; int yes; int optlen, maxseg; #if defined(_WIN32) struct thData *td; #endif #ifdef RFIODaemonRealTime #ifdef DUXV4 struct sched_param param; int mypid = 0; if (getconfent("RFIOD","NORT",0) == NULL) { param.sched_priority = SCHED_PRIO_RT_MIN; if (sched_setscheduler((pid_t) mypid,(int) SCHED_RR,¶m) < 0) log(LOG_DEBUG,"ropen_v3: sched_setscheduler (SCHED_RR,priority=%d) error : %s\n",(int) param.sched_priority, strerror(errno)); else log(LOG_DEBUG,"ropen_v3: changing to real time class (SCHED_RR,priority=%d)\n", (int) param.sched_priority); } #endif #endif #if defined(_WIN32) td = (struct thData*)TlsGetValue(tls_i); #endif /* Initialization of global variables */ ctrl_sock = s; first_write = 1; first_read = 1; /* Init myinfo to zeros */ myinfo.readop = myinfo.writop = myinfo.flusop = myinfo.statop = myinfo.seekop = myinfo.presop = 0; myinfo.rnbr = myinfo.wnbr = 0; /* Will remain at this value (indicates that the new sequential transfer mode has been used) */ myinfo.aheadop = 1; byte_read_from_network = 0; p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p, len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { /* * Reading open_v3 request. */ log(LOG_DEBUG,"ropen_v3: reading %d bytes\n",len) ; serrno = 0; if ((status = netread_timeout(s,rqstbuf,len,RFIO_CTRL_TIMEOUT)) != len) { log(LOG_ERR,"ropen_v3: read(): %s\n", neterror()); return -1 ; } status = 0; *account = *filename = *user = *reqhost = *vmstr = '\0'; p= rqstbuf ; unmarshall_WORD(p, uid); unmarshall_WORD(p, gid); unmarshall_WORD(p, mask); unmarshall_WORD(p, ftype); unmarshall_LONG(p, flags); unmarshall_LONG(p, mode); if (unmarshall_STRINGN(p, account, MAXACCTSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } if (unmarshall_STRINGN(p, filename, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } if (bet) { if (unmarshall_STRINGN(p, user, CA_MAXUSRNAMELEN+1) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } if (unmarshall_STRINGN(p, reqhost, MAXHOSTNAMELEN) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } unmarshall_LONG(p, passwd); unmarshall_WORD(p, mapping); if (unmarshall_STRINGN(p, vmstr, sizeof(vmstr)) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } } log(LOG_DEBUG,"vms string is %s\n", vmstr) ; get_client_actual_id(&uid, &gid, &mech, &auth_id, &rt, &mapping); if (bet) log(LOG_DEBUG,"Opening file %s for remote user: %s\n",filename,user); if (rt) log(LOG_DEBUG,"Mapping : %s\n",mapping ? "yes" : "no" ); if (rt && !mapping) { log(LOG_DEBUG,"passwd : %d\n",passwd); log(LOG_DEBUG,"uid: %d\n",uid ); log(LOG_DEBUG,"gid: %d\n",gid ); } /* * Someone in the site has tried to specify (uid,gid) directly ! */ if (bet && !mapping && !rt) { log(LOG_INFO,"attempt to make non-mapped I/O and modify uid or gid !\n"); errno=EACCES ; rcode=errno ; status= -1 ; } if ( rt ) { openlog("rfio",LOG_PID, LOG_USER) ; syslog(LOG_ALERT, "rfio: connection %s mapping by %s(%d,%d) from %s",(mapping ? "with" : "without"),user,uid,gid,host) ; #if !defined(_WIN32) closelog(); #endif } /* * MAPPED mode: user will be mapped to user "to" */ if ( !status && rt && mapping ) { char to[100]; int rcd,to_uid,to_gid; log(LOG_DEBUG,"Mapping (%s, %d, %d) \n",user, uid, gid ); if ( (rcd = get_user(host,user,uid,gid,to,&to_uid,&to_gid)) == -ENOENT ) { log(LOG_ERR,"sropen_v3(): get_user() error opening mapping file\n") ; status = -1; errno = EINVAL; rcode = SEHOSTREFUSED ; } else if ( abs(rcd) == 1 ) { log(LOG_ERR,"No entry found in mapping file for (%s,%s,%d,%d)\n", host,user,uid,gid); status = -1; errno = EACCES; rcode = SEHOSTREFUSED; } else { log(LOG_DEBUG,"(%s,%s,%d,%d) mapped to %s(%d,%d)\n", host,user,uid,gid,to,to_uid,to_gid) ; uid = to_uid ; gid = to_gid ; if ( uid < 100 || gid < 100 ) { errno = EACCES; status = -1; rcode = SEHOSTREFUSED; } } } /* * DIRECT access: the user specifies uid & gid by himself */ if( !status && rt && !mapping ) { char *rtuser; if( (rtuser = getconfent("RTUSER","CHECK",0) ) == NULL || ! strcmp (rtuser,"YES") ) { /* Port is also passwd */ sock = connecttpread(reqhost, passwd); #if defined(_WIN32) if( (sock != INVALID_SOCKET) && !checkkey(sock, passwd) ) #else if( (sock >= 0) && !checkkey(sock, passwd) ) #endif { status= -1 ; errno = EACCES; rcode= errno ; log(LOG_ERR,"ropen_v3: DIRECT mapping : permission denied\n"); } #if defined(_WIN32) if( sock == INVALID_SOCKET ) #else if (sock < 0) #endif { status= -1 ; log(LOG_ERR,"ropen_v3: DIRECT mapping failed: Couldn't connect %s\n",reqhost); rcode = EACCES; } } else log(LOG_INFO ,"Any DIRECT rfio request from out of site is authorized\n"); } if ( !status ) { int need_user_check = 1; char *pfn = NULL; log(LOG_DEBUG, "ropen_v3: uid %d gid %d mask %o ftype %d flags %d mode %d\n",uid, gid, mask, ftype, flags, mode); log(LOG_DEBUG, "ropen_v3: account: %s\n", account); log(LOG_DEBUG, "ropen_v3: filename: %s\n", filename); log(LOG_INFO, "ropen_v3(%s,0X%X,0X%X) for (%d,%d)\n",filename,flags,mode,uid,gid); status = rfio_handle_open(filename, ntohopnflg(flags), mode, mech, auth_id, uid, gid, &pfn, &handler_context, &need_user_check); if (status < 0) { char alarmbuf[1024]; rcode = serrno; sprintf(alarmbuf,"sropen(): %s",filename) ; log(LOG_DEBUG, "sropen: rfio_handler_open refused open: %s\n", sstrerror(serrno)) ; rfio_alrm(rcode,alarmbuf) ; } #if !defined(_WIN32) if (! status && need_user_check && ((status=chsuser(uid,gid,host,&rcode,((ntohopnflg(flags) & (O_WRONLY|O_RDWR)) != 0) ? "WTRUST" : "RTRUST")) < 0) && ((status=chsuser(uid,gid,host,&rcode,"OPENTRUST")) < 0) ) { if (status == -2) log(LOG_ERR,"ropen_v3: uid %d not allowed to open()\n",uid); else log(LOG_ERR,"ropen_v3: failed at chsuser(), rcode %d\n",rcode); status = -1 ; } #endif if (! status) { if (! need_user_check) { /* managed file */ mode = 0660; (void) umask(0) ; } else (void) umask(mask) ; fd = open(filename, ntohopnflg(flags), mode); #if defined(_WIN32) _setmode( fd, _O_BINARY ); /* default is text mode */ #endif log(LOG_DEBUG,"ropen_v3: open(%s,%d,%d) returned %x (hex)\n",filename,flags,mode,fd) ; if (fd < 0) { char alarmbuf[1024]; sprintf(alarmbuf,"sropen_v3: %s",filename) ; status= -1 ; rcode= errno ; log(LOG_DEBUG,"ropen_v3: open: %s\n",strerror(errno)) ; /* rfio_alrm(rcode,alarmbuf) ; */ } else { if (! need_user_check && (ntohopnflg(flags) & O_CREAT)) /* new managed file */ chown(filename, stagersuperuser.pw_uid, stagersuperuser.pw_gid); /* * Getting current offset */ status= lseek(fd,0L,SEEK_CUR) ; log(LOG_DEBUG,"ropen_v3: lseek(%d,0,SEEK_CUR) returned %x (hex)\n",fd,status) ; if ( status < 0 ) rcode= errno ; } } if (pfn != NULL) free(pfn); } if (! status && fd >= 0) { fromlen = sizeof(from); serrno = 0; if (getsockname(ctrl_sock, (struct sockaddr *)&from, &fromlen)) { log(LOG_ERR, "getsockname(): %s\n", neterror()); #if defined(_WIN32) return(-1); #else exit(1); #endif } serrno = 0; data_s = socket(from.ss_family, SOCK_STREAM, 0); if( data_s == INVALID_SOCKET ) { log( LOG_ERR, "datasocket(): %s\n", neterror()); #if defined(_WIN32) return(-1); #else exit(1); #endif } log(LOG_DEBUG, "data socket created fd=%d\n", data_s); if ((port = bind_v3_data_port ("ropen_v3", data_s)) < 0) { #if defined(_WIN32) return(-1); #else exit(1); #endif } log(LOG_INFO, "ropen_v3: assigning data port %d\n", port); serrno = 0; if( listen(data_s, 5) == INVALID_SOCKET ) { log(LOG_ERR, "listen: %s\n", neterror()); #if defined(_WIN32) return(-1); #else exit(1); #endif } } } /* * Sending back status to the client */ p= rqstbuf ; marshall_WORD(p,RQST_OPEN_V3) ; marshall_LONG(p,status); marshall_LONG(p,rcode) ; marshall_LONG(p,port) ; log(LOG_DEBUG, "ropen_v3: sending back status(%d) and errno(%d)\n",status,rcode); errno = ECONNRESET; serrno = 0; if (netwrite_timeout(s,rqstbuf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { log(LOG_ERR,"ropen_v3: netwrite_timeout(): %s\n", neterror()); return -1 ; } if (! status && fd >= 0) { /* * The rcvbuf on the data socket must be set _before_ * the connection is accepted! Otherwise the receiver will * only offer the default window, which for large MTU devices * (such as HIPPI) is far too small and performance goes down * the drain. * * The sndbuf must be set on the socket returned by accept() * as it is not inherited (at least not on SGI). * 98/08/05 - Jes */ log(LOG_DEBUG, "doing setsockopt rcv\n"); serrno = 0; if( setsockopt(data_s, SOL_SOCKET, SO_RCVBUF, (char*)&max_rcvbuf, sizeof(max_rcvbuf)) == SOCKET_ERROR ) log(LOG_ERR, "setsockopt open rcvbuf(%d bytes): %s\n", max_rcvbuf, neterror()); else log(LOG_DEBUG, "setsockopt rcvbuf on data socket (%d bytes)\n", max_rcvbuf); for (;;) { fromlen = sizeof(from); log(LOG_DEBUG, "ropen_v3: wait for accept to complete\n"); serrno = 0; data_sock = accept(data_s, (struct sockaddr*)&from, &fromlen); if( data_sock == INVALID_SOCKET ) { log(LOG_ERR, "data accept(): %s\n", neterror()); #if defined(_WIN32) return(-1); #else exit(1); #endif } else break; } log(LOG_DEBUG, "data accept is ok, fildesc=%d\n",data_sock); /* * Set the send socket buffer on the data socket (see comment * above before accept()) */ log(LOG_DEBUG, "doing setsockopt snd\n"); serrno = 0; if( setsockopt(data_sock, SOL_SOCKET, SO_SNDBUF, (char*)&max_sndbuf, sizeof(max_sndbuf)) == SOCKET_ERROR) log(LOG_ERR, "setsockopt open sndbuf(%d bytes): %s\n", max_sndbuf, neterror()); else log(LOG_DEBUG, "setsockopt sndbuf on data socket (%d bytes)\n", max_sndbuf); /* Set the keepalive option on both sockets */ yes = 1; serrno = 0; if( setsockopt(data_sock, SOL_SOCKET, SO_KEEPALIVE, (char*)&yes, sizeof(yes)) == SOCKET_ERROR) log(LOG_ERR, "setsockopt keepalive on data: %s\n", neterror()); else log(LOG_DEBUG, "setsockopt keepalive on data done\n"); yes = 1; serrno = 0; if( setsockopt(ctrl_sock, SOL_SOCKET, SO_KEEPALIVE, (char*)&yes, sizeof(yes)) == SOCKET_ERROR ) log(LOG_ERR, "setsockopt keepalive on ctrl: %s\n", neterror()); else log(LOG_DEBUG, "setsockopt keepalive on ctrl done\n"); #if (defined(__osf__) && defined(__alpha) && defined(DUXV4)) /* Set the keepalive interval to 20 mns instead of the default 2 hours */ yes = 20 * 60; if (setsockopt(data_sock,IPPROTO_TCP,TCP_KEEPIDLE,(char *)&yes,sizeof(yes)) < 0) { log(LOG_ERR, "setsockopt keepidle on data: %s\n",strerror(errno)); } log(LOG_DEBUG, "setsockopt keepidle on data done (%d s)\n",yes); yes = 20 * 60; if (setsockopt(ctrl_sock,IPPROTO_TCP,TCP_KEEPIDLE,(char *)&yes,sizeof(yes)) < 0) { log(LOG_ERR, "setsockopt keepidle on ctrl: %s\n",strerror(errno)); } log(LOG_DEBUG, "setsockopt keepidle on ctrl done (%d s)\n",yes); #endif #if !(defined(__osf__) && defined(__alpha) && defined(DUXV4)) /* * TCP_NODELAY seems to cause small Hippi packets on Digital UNIX 4.x */ yes = 1; serrno = 0; if( setsockopt(data_sock, IPPROTO_TCP, TCP_NODELAY, (char*)&yes, sizeof(yes)) == SOCKET_ERROR ) log(LOG_ERR, "setsockopt nodelay on data: %s\n", neterror()); else log(LOG_DEBUG,"setsockopt nodelay option set on data socket\n"); #endif /* !(defined(__osf__) && defined(__alpha) && defined(DUXV4)) */ yes = 1; serrno = 0; if( setsockopt(ctrl_sock, IPPROTO_TCP, TCP_NODELAY, (char*)&yes, sizeof(yes)) == SOCKET_ERROR ) log(LOG_ERR, "setsockopt nodelay on ctrl: %s\n", neterror()); else log(LOG_DEBUG,"setsockopt nodelay option set on ctrl socket\n"); } #if defined(SACCT) rfioacct(RQST_OPEN_V3,uid,gid,s,(int)ntohopnflg(flags),(int)mode,status,rcode,NULL,filename,NULL); #endif /* SACCT */ return fd ; } int srclose_v3(s, infop, fd) SOCKET s; int fd; struct rfiostat *infop; { int status; int rcode; char *p; char tmpbuf[21], tmpbuf2[21]; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif log(LOG_INFO,"%d read, %d readahead, %d write, %d flush, %d stat, %d lseek and %d preseek\n", myinfo.readop, myinfo.aheadop, myinfo.writop, myinfo.flusop, myinfo.statop, myinfo.seekop, myinfo.presop); log(LOG_INFO,"%s bytes read and %s bytes written\n", u64tostr(myinfo.rnbr,tmpbuf,0), u64tostr(myinfo.wnbr,tmpbuf2,0)) ; log(LOG_INFO, "rclose_v3(%d, %d)\n",s, fd) ; status = close(fd) ; rcode = ( status < 0 ) ? errno : 0 ; /* Close data socket */ serrno = 0; if( netclose(data_sock) == SOCKET_ERROR ) log(LOG_DEBUG, "rclose_v3: Error closing data socket fildesc=%d, error=%s\n", data_sock, neterror()); else log(LOG_DEBUG, "rclose_v3 : closing data socket fildesc=%d\n", data_sock) ; p= rqstbuf; marshall_WORD(p, RQST_CLOSE_V3); marshall_LONG(p, status); marshall_LONG(p, rcode); #if defined(SACCT) rfioacct(RQST_CLOSE_V3,0,0,s,0,0,status,rcode,&myinfo,NULL,NULL); #endif /* SACCT */ errno = ECONNRESET; serrno = 0; if (netwrite_timeout(s, rqstbuf, RQSTSIZE, RFIO_CTRL_TIMEOUT) != RQSTSIZE) { log(LOG_ERR, "rclose_v3: netwrite_timeout(): %s\n", neterror()); return -1 ; } serrno = 0; if( netclose(s) == SOCKET_ERROR ) log(LOG_DEBUG, "rclose_v3: Error closing control socket fildesc=%d, error=%s\n", s, neterror()); else log(LOG_DEBUG, "rclose_v3 : closing ctrl socket fildesc=%d\n", s); return status ; } void *produce_thread(int *ptr) { int fd = *ptr; int byte_read = -1; int error = 0; int total_produced = 0; while ((! error) && (byte_read != 0)) { if (Cthread_mutex_lock(&stop_read)) { log(LOG_ERR,"produce_thread: Cannot get mutex : serrno=%d\n", serrno); return(NULL); } if (stop_read) return (NULL); if (Cthread_mutex_unlock(&stop_read)) { log(LOG_ERR,"produce_thread: Cannot release mutex : serrno=%d\n", serrno); return(NULL); } Csemaphore_down(&empty); byte_read = read(fd,array[produced % daemonv3_rdmt_nbuf].p,daemonv3_rdmt_bufsize); if (byte_read > 0) { total_produced += byte_read; /* printf("Has read in buf %d (len %d)\n",produced % daemonv3_rdmt_nbuf,byte_read); */ array[produced % daemonv3_rdmt_nbuf].len = byte_read; } else { if (byte_read == 0) { log(LOG_DEBUG,"End of reading : total produced = %d,buffers=%d\n",total_produced,produced); /* array[produced % daemonv3_rdmt_nbuf].p = NULL; */ array[produced % daemonv3_rdmt_nbuf].len = 0; } else { if (byte_read < 0) { array[produced % daemonv3_rdmt_nbuf].len = -errno; error = -1; } } } produced++; Csemaphore_up(&full); } return(NULL); } void *consume_thread(int *ptr) { int fd = *ptr; int byte_written = -1; int error = 0, end = 0; int total_consumed = 0; char *buffer_to_write; int len_to_write; int saved_errno; while ((! error) && (! end)) { Csemaphore_down(&full); buffer_to_write = array[consumed % daemonv3_wrmt_nbuf].p; len_to_write = array[consumed % daemonv3_wrmt_nbuf].len; if (len_to_write > 0) { log(LOG_DEBUG,"Trying to write %d bytes from %X\n",len_to_write,buffer_to_write); byte_written = write(fd, buffer_to_write, len_to_write); /* If the write is successfull but incomplete (fs is full) we report the ENOSPC error immediately in order to simplify the code */ if ((byte_written >= 0) && (byte_written != len_to_write)) { byte_written = -1; errno = ENOSPC; } /* The following Cthread_mutex_lock call may modify this value */ saved_errno = errno; /* Error reporting to global var */ if (byte_written == -1) { error = 1; if (Cthread_mutex_lock(&write_error)) { log(LOG_ERR,"Cannot get mutex : serrno=%d",serrno); return(NULL); } write_error = saved_errno; if (Cthread_mutex_unlock(&write_error)) { log(LOG_ERR,"Cannot release mutex : serrno=%d",serrno); return(NULL); } log(LOG_DEBUG,"Error when writing : buffers=%d, error=%d\n",consumed,errno); } else { /* All bytes written to disks */ total_consumed += byte_written; log(LOG_DEBUG,"Has written buf %d to disk (len %d)\n",consumed % daemonv3_wrmt_nbuf,byte_written); } } else if (len_to_write == 0) { log(LOG_DEBUG,"End of writing : total consumed = %d,buffers=%d\n",total_consumed,consumed); end = 1; } else if (len_to_write < 0) { /* Error indicated by the thread reading from network, this thread just terminates */ error = 1; } consumed++; Csemaphore_up(&empty); } return(NULL); } void wait_consumer_thread(cid) int cid; { log(LOG_DEBUG,"Entering wait_consumer_thread\n"); /* Indicate to the consumer thread that an error has occured */ /* The consumer thread will then terminate */ Csemaphore_down(&empty); array[produced % daemonv3_wrmt_nbuf].len = -1; produced++; Csemaphore_up(&full); log(LOG_INFO,"Joining thread\n"); log(LOG_DEBUG,"Joining consumer thread after error in main thread\n"); if (Cthread_join(cid,NULL) < 0) { log(LOG_ERR,"Error joining consumer thread after error in main thread, serrno=%d\n",serrno); return; } } #if defined(_WIN32) int srread_v3(s, infop, fd) SOCKET s; #else int srread_v3(ctrl_sock, infop, fd) int ctrl_sock; #endif int fd; struct rfiostat* infop; { int status; /* Return code */ int rcode; /* To send back errno */ int how; /* lseek mode */ int offset; /* lseek offset */ int size; /* Requested write size */ char *p; /* Pointer to buffer */ #if !defined(_WIN32) char *iobuffer; #endif off_t bytes2send; fd_set fdvar, fdvar2; extern int max_sndbuf; struct stat st; char rfio_buf[BUFSIZ]; int eof_met; int join_done; int DISKBUFSIZE_READ = (1 * 1024 * 1024); int n; int cid1; int el; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); ctrl_sock = s; #endif /* * Receiving request, */ log(LOG_DEBUG, "rread_v3(%d, %d)\n",ctrl_sock, fd); if (first_read) { char *p; first_read = 0; eof_met = 0; join_done = 0; if( (p = getconfent("RFIO", "DAEMONV3_RDSIZE", 0)) != NULL ) { if (atoi(p) > 0) DISKBUFSIZE_READ = atoi(p); } daemonv3_rdmt = DAEMONV3_RDMT; if( (p = getconfent("RFIO", "DAEMONV3_RDMT", 0)) != NULL ) if (*p == '0') daemonv3_rdmt = 0; else daemonv3_rdmt = 1; daemonv3_rdmt_nbuf = DAEMONV3_RDMT_NBUF; if( (p = getconfent("RFIO", "DAEMONV3_RDMT_NBUF", 0)) != NULL ) if (atoi(p) > 0) daemonv3_rdmt_nbuf = atoi(p); daemonv3_rdmt_bufsize = DAEMONV3_RDMT_BUFSIZE; if( (p = getconfent("RFIO", "DAEMONV3_RDMT_BUFSIZE", 0)) != NULL ) if (atoi(p) > 0) daemonv3_rdmt_bufsize = atoi(p); log(LOG_DEBUG,"rread_v3 : daemonv3_rdmt=%d,daemonv3_rdmt_nbuf=%d,daemonv3_rdmt_bufsize=%d\n", daemonv3_rdmt,daemonv3_rdmt_nbuf,daemonv3_rdmt_bufsize); if (daemonv3_rdmt) { /* Indicates we are using RFIO V3 and multithreadding while reading */ myinfo.aheadop = 3; /* Allocating circular buffer itself */ log(LOG_DEBUG, "rread_v3 allocating circular buffer : %d bytes\n",sizeof(struct element) * daemonv3_rdmt_nbuf); if ((array = (struct element *)malloc(sizeof(struct element) * daemonv3_rdmt_nbuf)) == NULL) { log(LOG_ERR, "rread_v3: malloc array: ERROR occured (errno=%d)", errno); return -1 ; } log(LOG_DEBUG, "rread_v3 malloc array allocated : 0X%X\n",array); /* Allocating memory for each element of circular buffer */ for (el=0; el < daemonv3_rdmt_nbuf; el++) { log(LOG_DEBUG, "rread_v3 allocating circular buffer element %d: %d bytes\n",el,daemonv3_rdmt_bufsize); if ((array[el].p = (char *)malloc(daemonv3_rdmt_bufsize)) == NULL) { log(LOG_ERR, "rread_v3: malloc array element %d: ERROR occured (errno=%d)", el, errno); return -1 ; } log(LOG_DEBUG, "rread_v3 malloc array element %d allocated : 0X%X\n",el, array[el].p); } } else { log(LOG_DEBUG, "rread_v3 allocating malloc buffer : %d bytes\n",DISKBUFSIZE_READ); if ((iobuffer = (char *)malloc(DISKBUFSIZE_READ)) == NULL) { log(LOG_ERR, "rread_v3: malloc: ERROR occured (errno=%d)", errno); return -1 ; } log(LOG_DEBUG, "rread_v3 malloc buffer allocated : 0X%X\n",iobuffer); } if (fstat(fd,&st) < 0) { log(LOG_ERR, "rread_v3: fstat(): ERROR occured (errno=%d)", errno); return -1 ; } log(LOG_DEBUG, "rread_v3 filesize : %d bytes\n",st.st_size); if ((offset = lseek(fd,0L,SEEK_CUR)) < 0) { log(LOG_ERR, "rread_v3: lseek offset(): ERROR occured (errno=%d)", errno); return -1 ; } bytes2send = st.st_size - offset; if (bytes2send < 0) bytes2send = 0; log(LOG_DEBUG, "rread_v3: %d bytes to send (offset taken into account)\n",bytes2send); p = rfio_buf; marshall_WORD(p,RQST_READ_V3); marshall_LONG(p,bytes2send); log(LOG_DEBUG, "rread_v3: sending %d bytes", RQSTSIZE); errno = ECONNRESET; serrno = 0; if ((n = netwrite_timeout(ctrl_sock, rfio_buf, RQSTSIZE, RFIO_CTRL_TIMEOUT)) != RQSTSIZE) { log(LOG_ERR, "rread_v3: netwrite_timeout(): %s\n", neterror()); return -1 ; } if (daemonv3_rdmt) { Csemaphore_init(&empty,daemonv3_rdmt_nbuf); Csemaphore_init(&full,0); if ((cid1 = Cthread_create((void *(*)(void *))produce_thread,(void *)&fd)) < 0) { log(LOG_ERR,"Cannot create producer thread : serrno=%d,errno=%d\n",serrno,errno); return(-1); } } } /* * Reading data from the network. */ while (1) { struct timeval t; fd_set *write_fdset; FD_ZERO(&fdvar); FD_SET(ctrl_sock,&fdvar); FD_ZERO(&fdvar2); FD_SET(data_sock,&fdvar2); t.tv_sec = 10; t.tv_usec = 0; if (eof_met) write_fdset = NULL; else write_fdset = &fdvar2; log(LOG_DEBUG,"srread: doing select\n") ; serrno = 0; if( select(FD_SETSIZE, &fdvar, write_fdset, NULL, &t) == SOCKET_ERROR ) { log(LOG_ERR, "srread_v3: select failed: %s\n", neterror()); return -1; } if( FD_ISSET(ctrl_sock, &fdvar) ) { int n, magic, code; /* Something received on the control socket */ log(LOG_DEBUG, "ctrl socket: reading %d bytes\n", RQSTSIZE) ; errno = ECONNRESET; serrno = 0; if ((n = netread_timeout(ctrl_sock,rqstbuf,RQSTSIZE,RFIO_CTRL_TIMEOUT)) != RQSTSIZE) { log(LOG_ERR, "read ctrl socket: netread(): %s\n", neterror()); return -1 ; } p = rqstbuf ; unmarshall_WORD(p,magic) ; unmarshall_WORD(p,code) ; /* what to do ? */ if (code == RQST_CLOSE_V3) { log(LOG_DEBUG,"close request: magic: %x code: %x\n", magic, code); if (!daemonv3_rdmt) { log(LOG_DEBUG,"freeing iobuffer at 0X%X\n",iobuffer); free(iobuffer); } else { if(!join_done) { if (Cthread_mutex_lock(&stop_read)) { log(LOG_ERR,"srread_v3: Cannot get mutex : serrno=%d\n", serrno); return(-1); } stop_read = 1; if (Cthread_mutex_unlock(&stop_read)) { log(LOG_ERR,"srread_v3: Cannot release mutex : serrno=%d\n", serrno); return(-1); } Csemaphore_up(&empty); if (Cthread_join(cid1,NULL) < 0) { log(LOG_ERR,"srread_v3: Error joining producer, serrno=%d\n", serrno); return(-1); } } for (el=0; el < daemonv3_rdmt_nbuf; el++) { log(LOG_DEBUG,"freeing array element %d at 0X%X\n",el,array[el].p); free(array[el].p); } log(LOG_DEBUG,"freeing array at 0X%X\n",array); free(array); } srclose_v3(ctrl_sock,&myinfo,fd); return 0; } else { log(LOG_ERR,"unknown request: magic: %x code: %x\n",magic,code) ; return(-1); } } /* * Reading data on disk. */ if( !eof_met && (FD_ISSET(data_sock, &fdvar2)) ) { if (daemonv3_rdmt) { Csemaphore_down(&full); if (array[consumed % daemonv3_rdmt_nbuf].len > 0) { iobuffer = array[consumed % daemonv3_rdmt_nbuf].p; status = array[consumed % daemonv3_rdmt_nbuf].len; } else if (array[consumed % daemonv3_rdmt_nbuf].len == 0) { status = 0; iobuffer = NULL; log(LOG_DEBUG,"Waiting for producer thread\n"); if (Cthread_join(cid1,NULL) < 0) { log(LOG_ERR,"Error joining producer, serrno=%d\n",serrno); return(-1); } join_done = 1; } else if (array[consumed % daemonv3_rdmt_nbuf].len < 0) { status = -1; errno = -(array[consumed % daemonv3_rdmt_nbuf].len); } consumed++; } else status = read(fd,iobuffer,DISKBUFSIZE_READ); /* To simulate a read I/O error status = -1; errno = 5; */ rcode = (status < 0) ? errno:0; log(LOG_DEBUG, "%d bytes have been read on disk\n",status) ; if (status == 0) { if (daemonv3_rdmt) Csemaphore_up(&empty); eof_met = 1; p = rqstbuf; marshall_WORD(p,REP_EOF) ; log(LOG_DEBUG, "rread_v3: eof\n") ; errno = ECONNRESET; serrno = 0; if ((n = netwrite_timeout(ctrl_sock, rqstbuf, RQSTSIZE, RFIO_CTRL_TIMEOUT)) != RQSTSIZE) { log(LOG_ERR,"rread_v3: netwrite_timeout(): %s\n", neterror()); return -1 ; } } /* status == 0 */ else if (status < 0) { if (daemonv3_rdmt) Csemaphore_up(&empty); p = rqstbuf; marshall_WORD(p, REP_ERROR); marshall_LONG(p, status); marshall_LONG(p, rcode); log(LOG_DEBUG, "rread_v3: status %d, rcode %d\n", status, rcode) ; errno = ECONNRESET; serrno = 0; if ((n = netwrite_timeout(ctrl_sock, rqstbuf, RQSTSIZE, RFIO_CTRL_TIMEOUT)) != RQSTSIZE) { log(LOG_ERR, "rread_v3: netwrite_timeout(): %s\n", neterror()); return -1 ; } log(LOG_DEBUG, "read_v3: waiting ack for error\n"); serrno = 0; if ((n = netread_timeout(ctrl_sock,rqstbuf,RQSTSIZE,RFIO_CTRL_TIMEOUT)) != RQSTSIZE) { if (n == 0) #if defined(_WIN32) WSASetLastError(WSAECONNRESET); #else errno = ECONNRESET; #endif /* WIN32 */ log(LOG_ERR, "read ctrl socket: read(): %s\n", neterror()); } return(-1); } else { log(LOG_DEBUG, "rread_v3: writing %d bytes to data socket %d\n",status, data_sock) ; #if defined(_WIN32) WSASetLastError(WSAECONNRESET); if( (n = send(data_sock, iobuffer, status, 0)) != status ) { log(LOG_ERR, "rread_v3: send() (to data sock): %s", geterr() ); log(LOG_ERR, "rread_v3: freeing iobuffer after error in send: 0X%X\n", iobuffer); free(iobuffer); return -1; } #else errno = ECONNRESET; if( (n = netwrite(data_sock, iobuffer, status)) != status ) { log(LOG_ERR, "rread_v3: netwrite(): %s\n", strerror(errno)); return -1 ; } #endif if (daemonv3_rdmt) Csemaphore_up(&empty); myinfo.rnbr += status; myinfo.readop++; } } } } int srwrite_v3(s, infop, fd) SOCKET s; int fd; struct rfiostat *infop; { int status; /* Return code */ int rcode; /* To send back errno */ int how; /* lseek mode */ int offset; /* lseek offset */ int size; /* Requested write size*/ char *p; /* Pointer to buffer */ #if !defined(_WIN32) char *iobuffer; #endif fd_set fdvar, fdvar2; int byte_written_by_client; extern int max_rcvbuf; int maxseg; #if defined(_AIX) socklen_t optlen; #else int optlen; #endif int byte_in_diskbuffer = 0; char *iobuffer_p; int max_rcv_wat; struct timeval t; int sizeofdummy; /* * Put dummy on heap to avoid large arrays in thread stack */ unsigned char *dummy; int DISKBUFSIZE_WRITE = (1*1024*1024); int el; int cid2; int saved_errno; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif /* * Receiving request, */ log(LOG_DEBUG, "rwrite_v3(%d, %d)\n",s, fd); if( first_write ) { char *p; first_write = 0; if ((p = getconfent("RFIO","DAEMONV3_WRSIZE",0)) != NULL) { if (atoi(p) > 0) DISKBUFSIZE_WRITE = atoi(p); } daemonv3_wrmt = DAEMONV3_WRMT; if( (p = getconfent("RFIO", "DAEMONV3_WRMT", 0)) != NULL ) if (*p == '0') daemonv3_wrmt = 0; else daemonv3_wrmt = 1; daemonv3_wrmt_nbuf = DAEMONV3_WRMT_NBUF; if( (p = getconfent("RFIO", "DAEMONV3_WRMT_NBUF", 0)) != NULL ) if (atoi(p) > 0) daemonv3_wrmt_nbuf = atoi(p); daemonv3_wrmt_bufsize = DAEMONV3_WRMT_BUFSIZE; DISKBUFSIZE_WRITE = DAEMONV3_WRMT_BUFSIZE; if( (p = getconfent("RFIO", "DAEMONV3_WRMT_BUFSIZE", 0)) != NULL ) if (atoi(p) > 0) { daemonv3_wrmt_bufsize = atoi(p); DISKBUFSIZE_WRITE = atoi(p); } log(LOG_DEBUG,"rwrite_v3 : daemonv3_wrmt=%d,daemonv3_wrmt_nbuf=%d,daemonv3_wrmt_bufsize=%d\n", daemonv3_wrmt,daemonv3_wrmt_nbuf,daemonv3_wrmt_bufsize); if (daemonv3_wrmt) { /* Indicates we are using RFIO V3 and multithreading while writing */ myinfo.aheadop = 3; /* Allocating circular buffer itself */ log(LOG_DEBUG, "rwrite_v3 allocating circular buffer : %d bytes\n",sizeof(struct element) * daemonv3_wrmt_nbuf); if ((array = (struct element *)malloc(sizeof(struct element) * daemonv3_wrmt_nbuf)) == NULL) { log(LOG_ERR, "rwrite_v3: malloc array: ERROR occured (errno=%d)", errno); return -1 ; } log(LOG_DEBUG, "rwrite_v3 malloc array allocated : 0X%X\n",array); /* Allocating memory for each element of circular buffer */ for (el=0; el < daemonv3_wrmt_nbuf; el++) { log(LOG_DEBUG, "rwrite_v3 allocating circular buffer element %d: %d bytes\n",el,daemonv3_wrmt_bufsize); if ((array[el].p = (char *)malloc(daemonv3_wrmt_bufsize)) == NULL) { log(LOG_ERR, "rwrite_v3: malloc array element %d: ERROR occured (errno=%d)", el, errno); return -1 ; } log(LOG_DEBUG, "rwrite_v3 malloc array element %d allocated : 0X%X\n",el, array[el].p); } } else { log(LOG_DEBUG, "rwrite_v3 allocating malloc buffer : %d bytes\n",DISKBUFSIZE_WRITE); if ((iobuffer = (char *)malloc(DISKBUFSIZE_WRITE)) == NULL) { log(LOG_ERR, "rwrite_v3: malloc: ERROR occured (errno=%d)", errno); return -1 ; } log(LOG_DEBUG, "rwrite_v3 malloc buffer allocated : 0X%X\n",iobuffer); } byte_in_diskbuffer = 0; if (daemonv3_wrmt) iobuffer_p = NULL; /* For safety */ else iobuffer_p = iobuffer; #if !defined(_WIN32) optlen = sizeof(maxseg); if (getsockopt(data_sock,IPPROTO_TCP,TCP_MAXSEG,(char *)&maxseg,&optlen) < 0) { log(LOG_ERR,"rfio","rwrite_v3: getsockopt: ERROR occured (errno=%d)",errno) ; return -1 ; } log(LOG_DEBUG,"rwrite_v3: max TCP segment: %d\n",maxseg); #endif /* WIN32 */ if (daemonv3_wrmt) { Csemaphore_init(&empty,daemonv3_wrmt_nbuf); Csemaphore_init(&full,0); if ((cid2 = Cthread_create((void *(*)(void *))&consume_thread,(void *)&fd)) < 0) { log(LOG_ERR,"Cannot create consumer thread : serrno=%d,errno=%d\n",serrno,errno); return(-1); } } } /* End of if( first_write ) */ /* * Reading data from the network. */ while (1) { FD_ZERO(&fdvar); FD_SET(ctrl_sock, &fdvar); FD_SET(data_sock, &fdvar); t.tv_sec = 10; t.tv_usec = 0; log(LOG_DEBUG,"rwrite: doing select\n") ; serrno = 0; if( select(FD_SETSIZE, &fdvar, NULL, NULL, &t) == SOCKET_ERROR ) { log(LOG_ERR, "rwrite_v3: select: %s", neterror()); if (daemonv3_wrmt) wait_consumer_thread(cid2); return -1; } if( FD_ISSET(ctrl_sock, &fdvar) ) { int n, magic, code; /* Something received on the control socket */ log(LOG_DEBUG, "ctrl socket: reading %d bytes\n",RQSTSIZE) ; serrno = 0; if( (n = netread_timeout(ctrl_sock, rqstbuf, RQSTSIZE, RFIO_CTRL_TIMEOUT)) != RQSTSIZE ) { if (n == 0) #if defined(_WIN32) WSASetLastError(WSAECONNRESET); #else errno = ECONNRESET; #endif log(LOG_ERR, "read ctrl socket: netread(): %s\n", neterror()); if (daemonv3_wrmt) wait_consumer_thread(cid2); return -1; } p = rqstbuf ; unmarshall_WORD(p,magic) ; unmarshall_WORD(p,code) ; unmarshall_LONG(p,byte_written_by_client); if (code == RQST_CLOSE_V3) log(LOG_DEBUG,"close request: magic: %x code: %x\n",magic,code) ; else log(LOG_DEBUG,"unknown request: magic: %x code: %x\n",magic,code) ; log(LOG_DEBUG, "data socket: read_from_net=%d, written_by_client=%d\n", byte_read_from_network, byte_written_by_client); if( byte_read_from_network == byte_written_by_client ) { /* * Writing last buffered data on disk if necessary */ if( byte_in_diskbuffer ) { log(LOG_DEBUG, "writing last %d bytes on disk\n",byte_in_diskbuffer) ; if (daemonv3_wrmt) { array[produced % daemonv3_wrmt_nbuf].len = byte_in_diskbuffer; produced++; Csemaphore_up(&full); /* Indicate to the consumer thread that writing is finished */ Csemaphore_down(&empty); array[produced % daemonv3_wrmt_nbuf].len = 0; produced++; Csemaphore_up(&full); } else { status = write(fd,iobuffer,byte_in_diskbuffer); /* If the write is successfull but incomplete (fs is full) we report the ENOSPC error immediately in order to simplify the code */ if ((status > 0) && (status != byte_in_diskbuffer)) { status = -1; errno = ENOSPC; } } } /* if( byte_in_diskbuffer ) */ else { if (daemonv3_wrmt) { /* Indicate to the consumer thread that writing is finished */ Csemaphore_down(&empty); array[produced % daemonv3_wrmt_nbuf].len = 0; produced++; Csemaphore_up(&full); } } if (daemonv3_wrmt) { log(LOG_INFO,"Joining thread\n"); /* Wait for consumer thread */ /* We can then safely catch deferred disk write errors */ if (Cthread_join(cid2,NULL) < 0) { log(LOG_ERR,"Error joining consumer, serrno=%d\n",serrno); return(-1); } /* Catch deferred disk errors, if any */ if (Cthread_mutex_lock(&write_error)) { log(LOG_ERR,"Cannot get mutex : serrno=%d",serrno); return(-1); } if (write_error) { status = -1; saved_errno = write_error; } else status = byte_in_diskbuffer; if (Cthread_mutex_unlock(&write_error)) { log(LOG_ERR,"Cannot release mutex : serrno=%d",serrno); return(-1); } } if ((daemonv3_wrmt) && (status == -1)) errno = saved_errno; rcode = (status < 0) ? errno:0; if (status < 0) { p = rqstbuf; marshall_WORD(p,REP_ERROR) ; marshall_LONG(p,status) ; marshall_LONG(p,rcode) ; log(LOG_ERR, "rwrite_v3: status %d (%s), rcode %d\n", status, strerror(errno), rcode); errno = ECONNRESET; serrno = 0; if( (n = netwrite_timeout(s, rqstbuf, RQSTSIZE, RFIO_CTRL_TIMEOUT)) != RQSTSIZE ) { log(LOG_ERR, "rwrite_v3: netwrite_timeout(): %s\n", neterror()); /* No need to wait consumer thread here since it already exited after error */ return -1; } /* No deadlock here since the client has already sent a CLOSE request (thus no data is still in transit) */ log(LOG_DEBUG, "rwrite_v3: waiting ack for error\n"); serrno = 0; if ((n = netread_timeout(ctrl_sock,rqstbuf,RQSTSIZE,RFIO_CTRL_TIMEOUT)) != RQSTSIZE) { if (n == 0) #if defined(_WIN32) WSASetLastError(WSAECONNRESET); #else errno = ECONNRESET; #endif log(LOG_ERR, "read ctrl socket: netread(): %s\n", neterror()); /* No need to wait consumer thread here since it already exited after error */ return -1; } } else { myinfo.wnbr += byte_in_diskbuffer; if (byte_in_diskbuffer) myinfo.writop++; byte_in_diskbuffer = 0; if (daemonv3_wrmt) iobuffer_p = NULL; /* For safety */ else iobuffer_p = iobuffer; } if (!daemonv3_wrmt) { log(LOG_DEBUG,"freeing iobuffer at 0X%X\n",iobuffer); free(iobuffer); } else { for (el=0; el < daemonv3_wrmt_nbuf; el++) { log(LOG_DEBUG,"freeing array element %d at 0X%X\n",el,array[el].p); free(array[el].p); } log(LOG_DEBUG,"freeing array at 0X%X\n",array); free(array); } srclose_v3(ctrl_sock, &myinfo, fd); return 0; } /* if( byte_read_from_network == byte_written_by_client ) */ else { int diff; diff = byte_written_by_client - byte_read_from_network; if (byte_in_diskbuffer + diff > DISKBUFSIZE_WRITE) { /* If previous buffer is empty then we must take a new one */ if ((daemonv3_wrmt) && (byte_in_diskbuffer == 0)) { Csemaphore_down(&empty); iobuffer = array[produced % daemonv3_wrmt_nbuf].p; } iobuffer = (char*)realloc(iobuffer, byte_in_diskbuffer + diff); log(LOG_DEBUG, "data socket: realloc done to get %d additional bytes, buffer 0X%X\n", diff, iobuffer); if (iobuffer == NULL) { log(LOG_ERR, "realloc failed: %s\n", strerror(errno)); if (daemonv3_wrmt) wait_consumer_thread(cid2); return -1 ; } iobuffer_p = iobuffer + byte_in_diskbuffer; if (daemonv3_wrmt) { log(LOG_DEBUG,"Updating circular elem %d to address %X\n",produced % daemonv3_wrmt_nbuf,iobuffer); /* Update circular array element to take reallocation into account */ array[produced % daemonv3_wrmt_nbuf].p = iobuffer; array[produced % daemonv3_wrmt_nbuf].len = byte_in_diskbuffer + diff; } } /* buffer reallocation was necessary */ /* If previous buffer is empty then we must take a new one */ if ((daemonv3_wrmt) && (byte_in_diskbuffer == 0)) { Csemaphore_down(&empty); iobuffer = iobuffer_p = array[produced % daemonv3_wrmt_nbuf].p; } log(LOG_DEBUG, "data socket: reading residu %d bytes\n", diff) ; serrno = 0; if( (n = netread_timeout(data_sock, iobuffer_p, diff, RFIO_DATA_TIMEOUT)) != diff ) { if (n == 0) #if defined(_WIN32) WSASetLastError(WSAECONNRESET); #else errno = ECONNRESET; #endif log(LOG_ERR, "read ctrl socket: netread(): %s\n", neterror()); if (daemonv3_wrmt) wait_consumer_thread(cid2); return -1; } byte_read_from_network += diff; byte_in_diskbuffer += diff; /* * Writing data on disk. */ log(LOG_DEBUG, "writing %d bytes on disk\n",byte_in_diskbuffer) ; if (daemonv3_wrmt) { array[produced % daemonv3_wrmt_nbuf].len = byte_in_diskbuffer; produced++; Csemaphore_up(&full); /* Indicate to the consumer thread that writing is finished */ Csemaphore_down(&empty); array[produced % daemonv3_wrmt_nbuf].len = 0; produced++; Csemaphore_up(&full); } else { status = write(fd, iobuffer, byte_in_diskbuffer); /* If the write is successfull but incomplete (fs is full) we report the ENOSPC error immediately in order to simplify the code */ if ((status > 0) && (status != byte_in_diskbuffer)) { status = -1; errno = ENOSPC; } } if (daemonv3_wrmt) { log(LOG_INFO,"Joining thread\n"); /* Wait for consumer thread */ /* We can then safely catch deferred disk write errors */ if (Cthread_join(cid2,NULL) < 0) { log(LOG_ERR,"Error joining consumer, serrno=%d\n",serrno); return(-1); } /* Catch deferred disk write errors, if any */ if (Cthread_mutex_lock(&write_error)) { log(LOG_ERR,"Cannot get mutex : serrno=%d",serrno); return(-1); } if (write_error) { status = -1; saved_errno = write_error; } else status = byte_in_diskbuffer; if (Cthread_mutex_unlock(&write_error)) { log(LOG_ERR,"Cannot release mutex : serrno=%d",serrno); return(-1); } } if ((daemonv3_wrmt) && (status == -1)) errno = saved_errno; rcode = (status<0) ? errno:0; if (status < 0) { p = rqstbuf; marshall_WORD(p, REP_ERROR); marshall_LONG(p, status); marshall_LONG(p, rcode); log(LOG_DEBUG, "rwrite_v3: status %d, rcode %d\n", status, rcode); errno = ECONNRESET; serrno = 0; if( (n = netwrite_timeout(s, rqstbuf, RQSTSIZE, RFIO_CTRL_TIMEOUT)) != RQSTSIZE ) { log(LOG_ERR, "rwrite_v3: netwrite_timeout(): %s\n", neterror()); /* Consumer thread already exited */ return -1 ; } /* No deadlock possible here since all the data sent by the client using the data socket has been read at this point */ log(LOG_DEBUG, "rwrite_v3: waiting ack for error\n"); serrno = 0; if ((n = netread_timeout(ctrl_sock,rqstbuf,RQSTSIZE,RFIO_CTRL_TIMEOUT)) != RQSTSIZE) { if (n == 0) #if defined(_WIN32) WSASetLastError(WSAECONNRESET); #else errno = ECONNRESET; #endif log(LOG_ERR, "read ctrl socket: read(): %s\n", neterror()); /* Consumer thread already exited */ return -1; } } else { myinfo.wnbr += byte_in_diskbuffer; myinfo.writop++; byte_in_diskbuffer = 0; if (daemonv3_wrmt) iobuffer_p = NULL; /* For safety */ else iobuffer_p = iobuffer; } if (!daemonv3_wrmt) { log(LOG_DEBUG,"freeing iobuffer at 0X%X\n",iobuffer); free(iobuffer); } else { for (el=0; el < daemonv3_wrmt_nbuf; el++) { log(LOG_DEBUG,"freeing array element %d at 0X%X\n",el,array[el].p); free(array[el].p); } log(LOG_DEBUG,"freeing array at 0X%X\n",array); free(array); } srclose_v3(ctrl_sock, &myinfo, fd); return 0; } } if (FD_ISSET(data_sock,&fdvar)) { int n,can_be_read; if ((daemonv3_wrmt) && (byte_in_diskbuffer == 0)) { log(LOG_DEBUG, "Data received on data socket, new buffer %d requested\n",produced % daemonv3_wrmt_nbuf); Csemaphore_down(&empty); iobuffer = iobuffer_p = array[produced % daemonv3_wrmt_nbuf].p; } log(LOG_DEBUG,"iobuffer_p = %X,DISKBUFSIZE_WRITE = %d\n",iobuffer_p,DISKBUFSIZE_WRITE); serrno = 0; #if defined(_WIN32) n = recv(data_sock, iobuffer_p, DISKBUFSIZE_WRITE-byte_in_diskbuffer, 0); if( (n == 0) || n == SOCKET_ERROR ) #else if( (n = read(data_sock, iobuffer_p, DISKBUFSIZE_WRITE-byte_in_diskbuffer)) <= 0 ) #endif { if (n == 0) #if defined(_WIN32) WSASetLastError(WSAECONNRESET); #else errno = ECONNRESET; #endif log(LOG_ERR, "read ctrl socket: recv(): %s\n", neterror()); if (daemonv3_wrmt) wait_consumer_thread(cid2); return -1; } else { can_be_read = n; log(LOG_DEBUG, "read data socket : %d bytes\n", can_be_read); } byte_read_from_network += can_be_read; byte_in_diskbuffer += can_be_read; iobuffer_p += can_be_read; /* * Writing data on disk. */ if (byte_in_diskbuffer == DISKBUFSIZE_WRITE) { log(LOG_DEBUG, "writing %d bytes on disk\n", byte_in_diskbuffer); if (daemonv3_wrmt) { array[produced % daemonv3_wrmt_nbuf].len = byte_in_diskbuffer; produced++; Csemaphore_up(&full); } else { status = write(fd, iobuffer, byte_in_diskbuffer); /* If the write is successfull but incomplete (fs is full) we report the ENOSPC error immediately in order to simplify the code */ if ((status > 0) && (status != byte_in_diskbuffer)) { status = -1; errno = ENOSPC; } } if (daemonv3_wrmt) { if (Cthread_mutex_lock(&write_error)) { log(LOG_ERR,"Cannot get mutex : serrno=%d",serrno); return(-1); } if (write_error) { status = -1; saved_errno = write_error; } else status = byte_in_diskbuffer; if (Cthread_mutex_unlock(&write_error)) { log(LOG_ERR,"Cannot release mutex : serrno=%d",serrno); return(-1); } } if ((daemonv3_wrmt) && (status == -1)) errno = saved_errno; rcode = (status < 0) ? errno:0; if (status < 0) { p = rqstbuf; marshall_WORD(p, REP_ERROR); marshall_LONG(p, status); marshall_LONG(p, rcode); log(LOG_ERR, "rwrite_v3: status %d (%s), rcode %d\n", status,strerror(errno), rcode) ; errno = ECONNRESET; serrno = 0; if ((n = netwrite_timeout(s,rqstbuf,RQSTSIZE,RFIO_CTRL_TIMEOUT)) != RQSTSIZE) { log(LOG_ERR, "rwrite_v3: netwrite_timeout(): %s\n", neterror()); /* Consumer thread already exited after error */ return -1 ; } /* * To avoid overflowing the local thread stack we must * put dummy on heap */ sizeofdummy = 256 * 1024; dummy = (unsigned char *)malloc(sizeof(unsigned char) * sizeofdummy); if (dummy == NULL) log(LOG_ERR, "rwrite_v3: malloc(): %s\n", strerror(errno)) ; /* There is a potential deadlock here since the client may be stuck in netwrite (cf rfio_write_v3), trying to write data on the data socket while both socket buffers (client + server) are full. To avoid this problem, we empty the data socket while waiting for the ack to be received on the control socket */ while (1) { FD_ZERO(&fdvar2); FD_SET(ctrl_sock,&fdvar2); FD_SET(data_sock,&fdvar2); t.tv_sec = 1; t.tv_usec = 0; log(LOG_DEBUG,"rwrite_v3: doing select after error writing on disk\n") ; if( select(FD_SETSIZE, &fdvar2, NULL, NULL, &t) == SOCKET_ERROR ) { #if defined(_WIN32) errno = WSAGetLastError(); #endif log(LOG_ERR,"rfio","rwrite_v3: select fdvar2 failed (errno=%d)",errno) ; /* Consumer thread already exited after error */ return -1 ; } if( FD_ISSET(ctrl_sock, &fdvar2) ) { /* The ack has been received on the control socket */ log(LOG_DEBUG, "rwrite_v3: waiting ack for error\n"); serrno = 0; n = netread_timeout(ctrl_sock, rqstbuf, RQSTSIZE, RFIO_CTRL_TIMEOUT); if (n != RQSTSIZE) { if (n == 0) #if defined(_WIN32) WSASetLastError(WSAECONNRESET); #else errno = ECONNRESET; #endif log(LOG_ERR, "read ctrl socket: read(): %s\n", neterror()); /* Consumer thread already exited after error */ return -1; } else { if (!daemonv3_wrmt) { log(LOG_DEBUG,"freeing iobuffer at 0X%X\n",iobuffer); free(iobuffer); } else { for (el=0; el < daemonv3_wrmt_nbuf; el++) { log(LOG_DEBUG,"freeing array element %d at 0X%X\n",el,array[el].p); free(array[el].p); } log(LOG_DEBUG,"freeing array at 0X%X\n",array); free(array); } /* srclose_v3(ctrl_sock,&myinfo,fd); */ return 0; } } if (FD_ISSET(data_sock,&fdvar2)) { /* Read as much data as possible from the data socket */ log(LOG_DEBUG, "rwrite_v3: emptying data socket (last disk write)\n"); serrno = 0; #if defined(_WIN32) n = recv(data_sock, dummy, sizeofdummy, 0); if( (n == 0) || (n == SOCKET_ERROR) ) #else n = read(data_sock, dummy, sizeofdummy); if( n <= 0 ) #endif { (void) free(dummy); if (n == 0) #if defined(_WIN32) WSASetLastError(WSAECONNRESET); #else errno = ECONNRESET; #endif log(LOG_ERR, "read emptying data socket: recv(): %s\n", neterror()); /* Consumer thread already exited after error */ return -1; } log(LOG_DEBUG, "rwrite_v3: emptying data socket, %d bytes read\n",n); } } free(dummy); } else { myinfo.wnbr += byte_in_diskbuffer; myinfo.writop++; byte_in_diskbuffer = 0; iobuffer_p = iobuffer; } } } } } int srlseek_v3(s,infop,fd) SOCKET s; int fd; struct rfiostat *infop; { int status; int rcode; int offset; int how; char *p; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p = rqstbuf + 2*WORDSIZE; unmarshall_LONG(p,offset); unmarshall_LONG(p,how); log(LOG_DEBUG,"rlseek_v3(%d, %d): offset %d, how: %d\n",s,fd,offset,how); status = lseek(fd, offset, how); rcode = (status < 0) ? errno:0; log(LOG_DEBUG,"rlseek_v3: status %d, rcode %d\n",status,rcode); p = rqstbuf; marshall_WORD(p,RQST_LSEEK_V3); marshall_LONG(p,status); marshall_LONG(p,rcode); serrno = 0; if (netwrite_timeout(s,rqstbuf,WORDSIZE+2*LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+2*LONGSIZE)) { log(LOG_ERR,"rlseek: netwrite_timeout(): %s\n", neterror()) ; return -1 ; } return status; } lcgdm-1.10.0/rfio/rfio_fclose.man0000644000175000017500000000215410222773541016152 0ustar ellertellert.\" .\" $Id: rfio_fclose.man,v 1.1 2005/03/31 13:13:02 baud Exp $ .\" .\" @(#)$RCSfile: rfio_fclose.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:02 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2001 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_FCLOSE 3 "$Date: 2005/03/31 13:13:02 $" CASTOR "Rfio Library Functions" .SH NAME rfio_fclose \- closes a file .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_fclose (FILE *" fd ");" .SH DESCRIPTION .B rfio_fclose closes the file whose descriptor \fBfd\fP is the one returned by .B rfio_fopen. .SH RETURN VALUE This routine returns 0 if successful, -1 if the operation failed and .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EBADF .I fd is not a valid file descriptor. .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SETIMEDOUT Timed out. .TP .B SEBADVERSION Version ID mismatch. .TP .B SEINTERNAL Internal error. .TP .B SECONNDROP Connection closed by remote end. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR rfio_fopen(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_fread.man0000644000175000017500000000237410222773541015764 0ustar ellertellert.\" .\" $Id: rfio_fread.man,v 1.1 2005/03/31 13:13:02 baud Exp $ .\" .\" @(#)$RCSfile: rfio_fread.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:02 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2001 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_FREAD 3 "$Date: 2005/03/31 13:13:02 $" CASTOR "Rfio Library Functions" .SH NAME rfio_fread \- reads in a file .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_fread (void *" ptr ", int " size ", int " items ", FILE *" fd ");" .SH DESCRIPTION .B rfio_fread reads .BI items times .BI size bytes, using the descriptor .BI fd generated by a previous .B rfio_fopen and strore them at location .BR ptr . .SH RETURN VALUE This routine returns -1 if the operation failed or the number of items actually read. In case of failure, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EBADF .I fd is a NULL pointer. .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SETIMEDOUT Timed out. .TP .B SEBADVERSION Version ID mismatch. .TP .B SECONNDROP Connection closed by remote end. .TP .B SECOMERR Communication error. .TP .B SENORCODE Host did not return error number. .SH SEE ALSO .BR rfio_fopen(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_close.man0000644000175000017500000000224210222773541016002 0ustar ellertellert.\" .\" $Id: rfio_close.man,v 1.1 2005/03/31 13:13:02 baud Exp $ .\" .\" @(#)$RCSfile: rfio_close.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:02 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2001 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_CLOSE 3 "$Date: 2005/03/31 13:13:02 $" CASTOR "Rfio Library Functions" .SH NAME rfio_close \- closes a file .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_close (int " s ");" .SH DESCRIPTION .B rfio_close closes the file whose descriptor \fBs\fP is the one returned by .B rfio_open. .SH RETURN VALUE This routine returns 0 if successful, -1 if the operation failed and .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EBADF .I s is not a valid file descriptor. .TP .B ENOSPC File system full when writing last blocks (V3 only). .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SETIMEDOUT Timed out. .TP .B SEBADVERSION Version ID mismatch. .TP .B SEINTERNAL Internal error. .TP .B SECONNDROP Connection closed by remote end. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR rfio_open(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/setopt.c0000644000175000017500000000705111336206564014651 0ustar ellertellert/* * $Id: setopt.c 3174 2010-02-15 09:01:40Z baud $ */ /* * Copyright (C) 1990-2009 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: setopt.c,v $ $Revision: 3174 $ $Date: 2010-02-15 10:01:40 +0100 (Mon, 15 Feb 2010) $ CERN/IT/PDP/DM Felix Hassine"; #endif /* not lint */ #include #define RFIO_KERNEL 1 #include "rfio.h" /* remote file I/O definitions */ #include "rfio_rfilefdt.h" /* * By default RFIO are buffered. */ static int rfio_opt= RFIO_READBUF ; /* * By default rfio_connect() reads NET entries */ static int rfio_net= RFIO_NET ; static int rfio_connretry = RFIO_RETRYIT ; /* * Connect retry option */ static int rfio_connect_retry_counter = 0 ; static int rfio_connect_retry_interval = 0 ; /* * Force local I/O access. Required in some cases. */ static int rfio_forcelocal = RFIO_NOLOCAL ; /* * User can set option through this function. */ int DLL_DECL rfiosetopt(opt,pval,len) int opt ; int * pval ; int len ; { switch(opt) { case RFIO_READOPT: rfio_opt= *pval ; return 0 ; case RFIO_NETOPT: rfio_net= *pval ; return 0 ; case RFIO_NETRETRYOPT: rfio_connretry= *pval ; return 0 ; case RFIO_CONNECTOPT: rfio_forcelocal= *pval ; return 0 ; case RFIO_CONNECT_RETRY_COUNT_OPT: rfio_connect_retry_counter = *pval ; return 0 ; case RFIO_CONNECT_RETRY_INT_OPT: rfio_connect_retry_interval = *pval ; return 0 ; default: errno= EINVAL ; return -1 ; } } /* * User can read an option through this function */ int rfioreadopt(opt) int opt ; { switch(opt) { case RFIO_READOPT: return ( rfio_opt ) ; case RFIO_NETOPT: return ( rfio_net ) ; case RFIO_NETRETRYOPT: return ( rfio_connretry ) ; case RFIO_CONNECTOPT: return ( rfio_forcelocal ) ; case RFIO_CONNECT_RETRY_COUNT_OPT: return ( rfio_connect_retry_counter ) ; case RFIO_CONNECT_RETRY_INT_OPT: return ( rfio_connect_retry_interval ) ; default: errno= EINVAL ; return -1 ; } } int DLL_DECL rfio_setbufsize(s, bufsize) int s; int bufsize; { char *p; int s_index; if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1) return (0); /* the file is local */ if (rfilefdt[s_index]->version3 == 1) return (0); /* no intermediate buffering */ if (bufsize < 0) { serrno = EINVAL; return (-1); } if (rfilefdt[s_index]->offset || rfilefdt[s_index]->socset || rfilefdt[s_index]->preseek) { serrno = EINVAL; /* cannot change buffer size once I/O has started */ return (-1); } if (rfilefdt[s_index]->_iobuf.base) { if (bufsize == rfilefdt[s_index]->_iobuf.hsize + rfilefdt[s_index]->_iobuf.dsize) return (0); if (bufsize == 0) { free (rfilefdt[s_index]->_iobuf.base); memset (&rfilefdt[s_index]->_iobuf, 0, sizeof(struct iobuf)); } else { p = realloc (rfilefdt[s_index]->_iobuf.base, bufsize); if (p == NULL) { serrno = errno; return (-1); } rfilefdt[s_index]->_iobuf.base = p; rfilefdt[s_index]->_iobuf.dsize = bufsize - rfilefdt[s_index]->_iobuf.hsize; rfilefdt[s_index]->_iobuf.ptr = iodata(rfilefdt[s_index]); rfilefdt[s_index]->_iobuf.count = 0; } } else { if (bufsize == 0) return (0); p = malloc (bufsize); if (p == NULL) { serrno = errno; return (-1); } rfilefdt[s_index]->_iobuf.base = p; rfilefdt[s_index]->_iobuf.hsize = 3 * LONGSIZE + WORDSIZE; rfilefdt[s_index]->_iobuf.dsize = bufsize - rfilefdt[s_index]->_iobuf.hsize; rfilefdt[s_index]->_iobuf.ptr = iodata(rfilefdt[s_index]); rfilefdt[s_index]->_iobuf.count = 0; } return (0); } lcgdm-1.10.0/rfio/rfioacct.c0000644000175000017500000000712511336205452015122 0ustar ellertellert/* * $Id: rfioacct.c 3172 2010-02-15 08:51:54Z baud $ */ /* * Copyright (C) 1998-2010 by CERN/IT/PDP/DM Olof Barring * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rfioacct.c,v $ $Revision: 3172 $ $Date: 2010-02-15 09:51:54 +0100 (Mon, 15 Feb 2010) $ CERN/IT/PDP/DM Olof Barring"; #endif /* not lint */ #define RFIO_KERNEL 1 #include #include #if defined(_WIN32) #include #include #include #else #include #include #include #endif #include "rfio.h" #include "sacct.h" void rfioacct(reqtype,uid,gid,ns,flag1,flag2,status,rc,infop,filename1,filename2) int reqtype; uid_t uid; gid_t gid; int ns; int flag1; int flag2; int status; int rc; struct rfiostat *infop; char *filename1,*filename2; { #if defined(SACCT) int acctreclen; struct acctrfio64ipv46 acct_rfio; struct sockaddr_storage local_addr; struct sockaddr_storage remote_addr; #if defined(_AIX) socklen_t addr_len; #else int addr_len; #endif static int ACCTRFIO_ON = -1; char *getconfent(); char *p = NULL; static int jid = -1; if ( ACCTRFIO_ON == -1 ) { if (p == NULL && (p = getconfent("ACCT", "RFIO", 0)) == NULL || (strcmp (p, "YES") && strcmp (p, "yes"))) ACCTRFIO_ON = 0; else ACCTRFIO_ON = 1; } if (jid == -1) jid = getpid(); if ( ACCTRFIO_ON == 0 ) return; if ( ns < 0 ) return; memset(&acct_rfio,'\0',sizeof(acct_rfio)); acct_rfio.reqtype = (int) reqtype; acct_rfio.uid = (int) uid; acct_rfio.gid = (int) gid; acct_rfio.jid = (int) jid; acct_rfio.accept_socket = ns; acct_rfio.flags.anonymous.flag1 = (int)flag1; acct_rfio.flags.anonymous.flag2 = (int)flag2; if ( infop != NULL ) { acct_rfio.nb_read = (int) infop->readop; acct_rfio.nb_write = (int) infop->writop; acct_rfio.nb_ahead = (int) infop->aheadop; acct_rfio.nb_stat = (int) infop->statop; acct_rfio.nb_seek = (int) infop->seekop; acct_rfio.nb_preseek = (int) infop->presop; acct_rfio.read_size = infop->rnbr; acct_rfio.write_size = infop->wnbr; } if (ns >= 0 ) { addr_len = sizeof(local_addr); getsockname(ns,(struct sockaddr *)&local_addr,&addr_len); acct_rfio.af = local_addr.ss_family; switch(acct_rfio.af) { case AF_INET: acct_rfio.addr.ipv4.local_addr = (int)((struct sockaddr_in *)&local_addr)->sin_addr.s_addr; break; case AF_INET6: memcpy(&acct_rfio.addr.ipv6.local_addr, &((struct sockaddr_in6 *)&local_addr)->sin6_addr.s6_addr, sizeof(acct_rfio.addr.ipv6.local_addr)); break; } addr_len = sizeof(remote_addr); getpeername(ns,(struct sockaddr *)&remote_addr,&addr_len); switch(acct_rfio.af) { case AF_INET: acct_rfio.addr.ipv4.remote_addr = (int)((struct sockaddr_in *)&remote_addr)->sin_addr.s_addr; break; case AF_INET6: memcpy(&acct_rfio.addr.ipv6.remote_addr, &((struct sockaddr_in6 *)&remote_addr)->sin6_addr.s6_addr, sizeof(acct_rfio.addr.ipv6.remote_addr)); break; } } if (filename1 != NULL ) { acct_rfio.len1 = min(2*MAXPATH,strlen(filename1)); strncpy(&acct_rfio.filename[0],filename1,acct_rfio.len1); } if (filename2 != NULL ) { acct_rfio.len2 = min(2*MAXPATH-acct_rfio.len1,strlen(filename2)); strncpy(&acct_rfio.filename[acct_rfio.len1],filename2,acct_rfio.len2); } acct_rfio.status = status; acct_rfio.rc = rc; acctreclen = ((char *)acct_rfio.filename - (char *) &acct_rfio) + strlen(acct_rfio.filename) + 1; wsacct(ACCTRFIO64IPV46, &acct_rfio, acctreclen); #endif /* SACCT */ return; } lcgdm-1.10.0/rfio/munlink.c0000644000175000017500000002674710222773541015022 0ustar ellertellert/* * $Id: munlink.c,v 1.1 2005/03/31 13:13:01 baud Exp $ */ /* * Copyright (C) 1995-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: munlink.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:01 $ CERN/IT/PDP/DM Jean-Damien Durand"; #endif /* not lint */ #include #include "Cmutex.h" #include "Castor_limits.h" #include #include "log.h" #define RFIO_KERNEL 1 #include "rfio.h" #include #include typedef struct socks { char host[CA_MAXHOSTNAMELEN+1]; int s ; int Tid; } munlink_connects ; static munlink_connects munlink_tab[MAXMCON]; /* UP TO MAXMCON connections simultaneously */ static int rfio_smunlink _PROTO((int, char *)); static int rfio_munlink_allocentry _PROTO((char *, int, int)); static int rfio_munlink_findentry _PROTO((char *,int)); static int rfio_unend_this _PROTO((int,int)); extern int rfio_newhost _PROTO((char *)); int DLL_DECL rfio_munlink(file) char *file ; { int rt ,rc ,fd, rfindex, Tid, parserc; char *host , *filename ; INIT_TRACE("RFIO_TRACE"); Cglobals_getTid(&Tid); TRACE(1, "rfio", "rfio_munlink(\"%s\"), Tid=%d", file, Tid); if (!(parserc = rfio_parseln(file,&host,&filename,NORDLINKS))) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file */ rfio_errno = 0; rc = rfio_HsmIf_unlink(filename); END_TRACE(); return(rc); } /* The file is local */ rc = unlink(filename) ; if ( rc < 0 ) serrno = 0; rfio_errno = 0; END_TRACE(); return (rc) ; } else { if (parserc < 0) { END_TRACE(); return(-1); } /* Look if already in */ serrno = 0; rfindex = rfio_munlink_findentry(host,Tid); TRACE(2, "rfio", "rfio_munlink: rfio_munlink_findentry(host=%s,Tid=%d) returns %d", host, Tid, rfindex); if (rfindex >= 0) { rc = rfio_smunlink(munlink_tab[rfindex].s,filename) ; END_TRACE(); return ( rc) ; } rc = 0; fd=rfio_connect(host,&rt) ; if ( fd < 0 ) { END_TRACE(); return (-1) ; } rfindex = rfio_munlink_allocentry(host,Tid,fd); TRACE(2, "rfio", "rfio_munlink: rfio_munlink_allocentry(host=%s,Tid=%d,s=%d) returns %d", host, Tid, fd, rfindex); serrno = 0; if ( rfindex >= 0 ) { rc = rfio_smunlink(fd,filename); } else { rc = rfio_smunlink(fd,filename) ; TRACE(2,"rfio","rfio_munlink() overflow connect table, host=%s, Tid=%d. Closing %d",host,Tid,fd); netclose(fd); } } END_TRACE(); return (rc) ; } static int pw_key = -1; static int old_uid_key = -1; static int rfio_smunlink(s,filename) int s ; char * filename ; { char buf[BUFSIZ]; int status; /* remote fopen() status */ int len; int rc, ans_req, rcode; char *p=buf; int uid; int gid; int *old_uid = NULL; struct passwd *pw_tmp; struct passwd *pw = NULL; char *nbuf ; char *n1 = ""; TRACE(3, "rfio", "rfio_smunlink(%s)", filename); if ( Cglobals_get(&old_uid_key, (void**)&old_uid, sizeof(int)) > 0 ) *old_uid = -1; Cglobals_get(&pw_key, (void**)&pw, sizeof(struct passwd)); len = strlen(filename)+1; uid = geteuid() ; gid = getegid () ; if ( uid != *old_uid ) { pw_tmp = Cgetpwuid(uid); if( pw_tmp == NULL ) { TRACE(3, "rfio" ,"rfio_smunlink: Cgetpwuid(): ERROR occured (errno=%d)",errno); rfio_unend_this(s,1); return(-1) ; } memcpy(pw, pw_tmp, sizeof(struct passwd)); *old_uid = uid; } marshall_WORD(p, B_RFIO_MAGIC); marshall_WORD(p, RQST_MSYMLINK); status = strlen(pw->pw_name)+strlen(n1)+strlen(filename)+3+2*WORDSIZE; marshall_LONG(p, status) ; if ( status > BUFSIZ ) { TRACE(2,"rfio","rfio_smunlink: request too long %d (max %d)",status,BUFSIZ); END_TRACE(); rfio_unend_this(s,0); serrno = E2BIG; return(-1); } if (netwrite_timeout(s,buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(3, "rfio", "smunlink: write(): ERROR occured (errno=%d)", errno); rfio_unend_this(s,0); return(-1); } nbuf = (char *) malloc( status ) ; if ( nbuf == NULL ) { TRACE(3, "rfio", "smunlink: malloc () failed"); rfio_unend_this(s,1); return(-1); } p = nbuf ; marshall_WORD(p,uid) ; marshall_WORD(p,gid) ; marshall_STRING( p, n1 ) ; marshall_STRING( p, filename ) ; marshall_STRING( p, pw->pw_name) ; if (netwrite_timeout(s,nbuf,status,RFIO_CTRL_TIMEOUT) != status ) { TRACE(3, "rfio", "smunlink: write(): ERROR occured (errno=%d)",errno); rfio_unend_this(s,0); free(nbuf); return(-1); } free(nbuf) ; /* * Getting back status */ if ((rc = netread_timeout(s, buf, WORDSIZE + 2*LONGSIZE, RFIO_CTRL_TIMEOUT)) != (WORDSIZE+ 2*LONGSIZE)) { TRACE(3, "rfio", "rfio_smunlink: read(): ERROR occured (errno=%d)", errno); rfio_unend_this(s, (rc <= 0 ? 0 : 1)); return(-1); } p = buf; unmarshall_WORD( p, ans_req ); unmarshall_LONG( p, status ) ; unmarshall_LONG( p, rcode ) ; if ( ans_req != RQST_MSYMLINK ) { TRACE(3,"rfio","rfio_smunlink: ERROR: answer does not correspond to request !"); rfio_unend_this(s,1); return(-1); } TRACE(3,"rfio","rfio_smunlink: return %d",rcode); rfio_errno = rcode ; if ( status < 0 ) { return(-1); } return(0) ; } int DLL_DECL rfio_unend() { int i,Tid, j=0 ; char buf[RQSTSIZE]; char *p=buf ; int rc = 0; INIT_TRACE("RFIO_TRACE"); Cglobals_getTid(&Tid); TRACE(3,"rfio","rfio_unend entered, Tid=%d", Tid); TRACE(3,"rfio","rfio_unend: Lock munlink_tab"); if (Cmutex_lock((void *) munlink_tab,-1) != 0) { TRACE(3,"rfio","rfio_unend: Cmutex_lock(munlink_tab,-1) error No %d (%s)", errno, strerror(errno)); END_TRACE(); return(-1); } for (i = 0; i < MAXMCON; i++) { if (munlink_tab[i].Tid == Tid) { if ((munlink_tab[i].s >= 0) && (munlink_tab[i].host[0] != '\0')) { marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_END); marshall_LONG(p, j); TRACE(3,"rfio","rfio_unend: close(munlink_tab[%d].s=%d), host=%s, Tid=%d",i,munlink_tab[i].s, munlink_tab[i].host, Tid); if (netwrite_timeout(munlink_tab[i].s,buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(3, "rfio", "rfio_unend: write(): ERROR occured (errno=%d), Tid=%d", errno, Tid); rc = -1; } netclose(munlink_tab[i].s); } munlink_tab[i].s = -1; munlink_tab[i].host[0] = '\0'; munlink_tab[i].Tid = -1; } } TRACE(3,"rfio","rfio_unend: Unlock munlink_tab"); if (Cmutex_unlock((void *) munlink_tab) != 0) { TRACE(3,"rfio","rfio_unend: Cmutex_unlock(munlink_tab) error No %d (%s)", errno, strerror(errno)); rc = -1; } END_TRACE(); return(rc); } /* This is a simplified version of rfio_unend() that just free entry in the table */ /* If flag is set a clean close (write on the socket) is tried */ static int rfio_unend_this(s,flag) int s; int flag; { int i,Tid, j=0 ; char buf[RQSTSIZE]; char *p=buf ; int rc = 0; Cglobals_getTid(&Tid); TRACE(3,"rfio","rfio_unend_this(s=%d,flag=%d) entered, Tid=%d", s, flag, Tid); TRACE(3,"rfio","rfio_unend_this: Lock munlink_tab"); if (Cmutex_lock((void *) munlink_tab,-1) != 0) { TRACE(3,"rfio","rfio_unend_this: Cmutex_lock(munlink_tab,-1) error No %d (%s)", errno, strerror(errno)); return(-1); } for (i = 0; i < MAXMCON; i++) { if (munlink_tab[i].Tid == Tid) { if ((munlink_tab[i].s == s) && (munlink_tab[i].host[0] != '\0')) { if (flag) { marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_END); marshall_LONG(p, j); TRACE(3,"rfio","rfio_unend_this: close(munlink_tab[%d].s=%d), host=%s, Tid=%d",i,munlink_tab[i].s, munlink_tab[i].host, Tid); if (netwrite_timeout(munlink_tab[i].s,buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(3, "rfio", "rfio_unend_this: netwrite_timeout(): ERROR occured (errno=%d), Tid=%d", errno, Tid); } } netclose(munlink_tab[i].s); munlink_tab[i].s = -1; munlink_tab[i].host[0] = '\0'; munlink_tab[i].Tid = -1; } } } TRACE(3,"rfio","rfio_unend_this: Unlock munlink_tab"); if (Cmutex_unlock((void *) munlink_tab) != 0) { TRACE(3,"rfio","rfio_unend_this: Cmutex_unlock(munlink_tab) error No %d (%s)", errno, strerror(errno)); rc = -1; } return(rc); } /* * Seach for a free index in the munlink_tab table */ static int rfio_munlink_allocentry(hostname,Tid,s) char *hostname; int Tid; int s; { int i; int rc; TRACE(3,"rfio","rfio_munlink_allocentry: Lock munlink_tab"); if (Cmutex_lock((void *) munlink_tab,-1) != 0) { TRACE(3,"rfio","rfio_munlink_allocentry: Cmutex_lock(munlink_tab,-1) error No %d (%s)", errno, strerror(errno)); return(-1); } /* Scan it */ for (i = 0; i < MAXMCON; i++) { if (munlink_tab[i].host[0] == '\0') { rc = i; strncpy(munlink_tab[i].host,hostname,CA_MAXHOSTNAMELEN); munlink_tab[i].host[CA_MAXHOSTNAMELEN] = '\0'; munlink_tab[i].Tid = Tid; munlink_tab[i].s = s; goto _rfio_munlink_allocentry_return; } } serrno = ENOENT; rc = -1; _rfio_munlink_allocentry_return: TRACE(3,"rfio","rfio_munlink_allocentry: Unlock munlink_tab"); if (Cmutex_unlock((void *) munlink_tab) != 0) { TRACE(3,"rfio","rfio_munlink_allocentry: Cmutex_unlock(munlink_tab) error No %d (%s)", errno, strerror(errno)); return(-1); } return(rc); } /* * Seach for a given index in the munlink_tab table */ static int rfio_munlink_findentry(hostname,Tid) char *hostname; int Tid; { int i; int rc; TRACE(3,"rfio","rfio_munlink_findentry: Lock munlink_tab"); if (Cmutex_lock((void *) munlink_tab,-1) != 0) { TRACE(3,"rfio","rfio_munlink_findentry: Cmutex_lock(munlink_tab,-1) error No %d (%s)", errno, strerror(errno)); return(-1); } /* Scan it */ for (i = 0; i < MAXMCON; i++) { if ((strcmp(munlink_tab[i].host,hostname) == 0) && (munlink_tab[i].Tid == Tid)) { rc = i; /* Lie to rfio_lasthost() */ rfio_newhost(hostname); goto _rfio_munlink_findentry_return; } } serrno = ENOENT; rc = -1; _rfio_munlink_findentry_return: TRACE(3,"rfio","rfio_munlink_findentry: Unlock munlink_tab"); if (Cmutex_unlock((void *) munlink_tab) != 0) { TRACE(3,"rfio","rfio_munlink_findentry: Cmutex_unlock(munlink_tab) error No %d (%s)", errno, strerror(errno)); return(-1); } return(rc); } int DLL_DECL rfio_munlink_reset() { int i,Tid; int rc = 0; INIT_TRACE("RFIO_TRACE"); Cglobals_getTid(&Tid); TRACE(3,"rfio","rfio_munlink_reset entered, Tid=%d", Tid); TRACE(3,"rfio","rfio_munlink_reset: Lock munlink_tab"); if (Cmutex_lock((void *) munlink_tab,-1) != 0) { TRACE(3,"rfio","rfio_munlink_reset: Cmutex_lock(munlink_tab,-1) error No %d (%s)", errno, strerror(errno)); END_TRACE(); return(-1); } for (i = 0; i < MAXMCON; i++) { if ((munlink_tab[i].s >= 0) && (munlink_tab[i].host[0] != '\0')) { TRACE(3,"rfio","rfio_munlink_reset: Resetting socket fd=%d, host=%s\n", munlink_tab[i].s, munlink_tab[i].host); netclose(munlink_tab[i].s); } munlink_tab[i].s = -1; munlink_tab[i].host[0] = '\0'; munlink_tab[i].Tid = -1; } TRACE(3,"rfio","rfio_munlink_reset: Unlock munlink_tab"); if (Cmutex_unlock((void *) munlink_tab) != 0) { TRACE(3,"rfio","rfio_munlink_reset: Cmutex_unlock(munlink_tab) error No %d (%s)", errno, strerror(errno)); rc = -1; } END_TRACE(); return(rc); } lcgdm-1.10.0/rfio/symlink.c0000644000175000017500000001006110222773541015011 0ustar ellertellert/* * $Id: symlink.c,v 1.1 2005/03/31 13:13:04 baud Exp $ */ /* * Copyright (C) 1990-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: symlink.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:04 $ CERN/IT/PDP/DM Felix Hassine"; #endif /* not lint */ #define RFIO_KERNEL 1 #include "rfio.h" #include #include #include #include /* malloc prototype */ /* * returns -1 if an error occured or no information is available at the * daemon's host. 0 otherwise. */ int DLL_DECL rfio_symlink(n1,n2 ) char *n1 ; char *n2 ; { int c; int status ; char *nbuf ; int s ; char *host ; char * filename; char *p ; int ans_req ,rt, parserc ; int rcode ; int uid ; int gid ; struct passwd *pw ; char buf[BUFSIZ]; /* * The file is local. */ INIT_TRACE("RFIO_TRACE"); TRACE( 1, "rfio", " rfio_symlink (%s,%s)",n1,n2 ); if ( ! (parserc = rfio_parseln(n2,&host,&filename,NORDLINKS)) ) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file. */ TRACE(1,"rfio","rfio_symlink: %s is an HSM path", filename); END_TRACE(); rfio_errno = 0; serrno = SEOPNOTSUP; status = -1; return(status); } TRACE(2,"rfio","rfio_symlink local %s -> %s",filename,n1); #if ! defined(_WIN32) status = symlink(n1,filename) ; if ( status < 0 ) serrno = 0; #else { serrno = SEOPNOTSUP; status = -1;} #endif END_TRACE() ; rfio_errno = 0; return status ; } if (parserc < 0) { END_TRACE(); return(-1); } s = rfio_connect(host,&rt); if (s < 0) { END_TRACE(); return(-1); } uid = geteuid() ; gid = getegid () ; if ( (pw = Cgetpwuid(uid) ) == NULL ) { TRACE(2, "rfio" ,"rfio_symlink: Cgetpwuid() error %s", strerror(errno)); END_TRACE(); return -1 ; } p = buf ; marshall_WORD(p, B_RFIO_MAGIC); marshall_WORD(p, RQST_SYMLINK); status = strlen(pw->pw_name)+strlen(n1)+strlen(filename)+3+2*WORDSIZE; marshall_LONG(p, status) ; if (netwrite_timeout(s,buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio", "symlink: write(): ERROR occured (errno=%d)", errno); (void) close(s); END_TRACE(); return(-1); } nbuf = (char *) malloc( status ) ; if ( nbuf == NULL ) { TRACE(2, "rfio", "symlink: malloc () failed"); (void) close(s); END_TRACE(); return(-1); } p = nbuf ; marshall_WORD(p,uid) ; marshall_WORD(p,gid) ; marshall_STRING( p, n1 ) ; marshall_STRING( p, filename ) ; marshall_STRING( p, pw->pw_name) ; if (netwrite_timeout(s,nbuf,status,RFIO_CTRL_TIMEOUT) != status ) { TRACE(2, "rfio", "symlink: write(): ERROR occured (errno=%d)",errno); (void) close(s); free(nbuf); END_TRACE(); return(-1); } (void) free(nbuf) ; /* * Getting back status */ if ((c=netread_timeout(s, buf, WORDSIZE + 2*LONGSIZE, RFIO_CTRL_TIMEOUT)) != (WORDSIZE+ 2*LONGSIZE)) { if (c == 0) { serrno = SEOPNOTSUP; /* symbolic links not supported on remote machine */ TRACE(2, "rfio", "rfio_symlink: read(): ERROR occured (serrno=%d)", serrno); } else TRACE(2, "rfio", "rfio_symlink: read(): ERROR occured (errno=%d)", errno); (void) close(s); END_TRACE(); return(-1); } p = buf; unmarshall_WORD( p, ans_req ); unmarshall_LONG( p, status ) ; unmarshall_LONG( p, rcode ) ; if ( ans_req != RQST_SYMLINK ) { TRACE(1,"rfio","rfio_symlink: ERROR: answer does not correspond to request !"); (void) close(s); END_TRACE(); return(-1); } if ( status < 0 ) { TRACE(1,"rfio","rfio_symlink: failure, error %d",rcode); rfio_errno = rcode ; (void) close(s); END_TRACE(); return(status); } TRACE (2,"rfio","rfio_symlink succeded"); END_TRACE(); (void) close (s) ; return(status) ; } lcgdm-1.10.0/rfio/xywrite.c0000644000175000017500000001162311336205452015041 0ustar ellertellert/* * $Id: xywrite.c 3172 2010-02-15 08:51:54Z baud $ */ /* * Copyright (C) 1990-2010 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: xywrite.c,v $ $Revision: 3172 $ $Date: 2010-02-15 09:51:54 +0100 (Mon, 15 Feb 2010) $ CERN/IT/PDP/DM Frederic Hemmer"; #endif /* not lint */ /* xywrite.c Remote File I/O - Write a Fortran Logical Unit */ /* * C bindings : * * rfio_xywrite(int lun, char *buf, int nrec, int nwrit, * char *chopt, int *irc); * * FORTRAN bindings : * * XYWRITE(INTEGER*4 LUN, CHARACTER*(*)BUF, INTEGER*4 NREC, * INTEGER*4 NWANT, INTEGER*4 NGOT, CHARACTER*(*)CHOPT, * INTEGER*4 IRC) */ #define RFIO_KERNEL 1 /* system part of Remote File I/O */ #include "rfio.h" /* remote file I/O definitions */ #include extern int DLL_DECL switch_write(); int DLL_DECL rfio_xywrite(lun, buf, nrec, nwrit, chopt, irc) int lun, nrec, nwrit; char *buf, *chopt; int *irc; { char buffer[128]; /* general purpose buffer */ register char *p=buf; /* buffer pointer */ int optval; /* setsockopt() value */ int status; /* Fortran status */ int rcode; /* Remote return code */ int acc; register int i; /* general purpose index */ TRACE(1, "rfio", "rfio_xywrite(%d, %x, %d, %d, %s, %x)", lun, buf, nrec, nwrit, chopt, irc); if (ftnlun[lun] == (RFILE *) NULL) { /* Allocated ? */ TRACE(1, "rfio", "rfio_xywrite: %s", "Bad file number"); END_TRACE(); return(EBADF); } TRACE(2, "rfio", "rfio_xywrite: parsing options: [%s]",chopt); for (i=0;i< (int)strlen(chopt);i++) { switch (chopt[i]) { case ' ': break; default : *irc = SEBADFOPT; END_TRACE(); return(SEBADFOPT); } } if (!strcmp(ftnlun[lun]->host, "localhost")) { /* Local file ? */ acc = (int) ftnlun[lun]->access; *irc = switch_write(acc, &lun, buf, &nwrit, &nrec, LLM); END_TRACE(); return(*irc); } p = buffer; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_XYWRIT); marshall_LONG(p, nrec); marshall_LONG(p, nwrit); TRACE(2,"rfio","rfio_xywrite: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(ftnlun[lun]->s,buffer,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio" ,"rfio_xywrite: write(): ERROR occured (errno=%d)", errno); END_TRACE(); if ( serrno ) return ( serrno ) ; else return(errno); } if (ftnlun[lun]->bufsize < nwrit) { optval = nwrit; TRACE(2, "rfio", "rfio_xywrite: setsockopt(SOL_SOCKET, SO_SNDBUF): %d", optval); ftnlun[lun]->bufsize = nwrit; if (setsockopt(ftnlun[lun]->s, SOL_SOCKET, SO_SNDBUF, (char *)&optval, sizeof(optval)) == -1) { TRACE(2, "rfio" ,"rfio_xywrite: setsockopt(SO_SNDBUF): ERROR"); } } p = buffer; TRACE(2, "rfio", "rfio_xywrite: writing %d bytes", nwrit); if (netwrite_timeout(ftnlun[lun]->s, buf, nwrit, RFIO_DATA_TIMEOUT) != nwrit) { TRACE(2, "rfio" ,"rfio_xywrite: write(): ERROR occured (errno=%d)", errno); END_TRACE(); if ( serrno ) return ( serrno ) ; else return(errno); } TRACE(2, "rfio", "rfio_xywrite: reading %d bytes", 2*LONGSIZE); if (netread_timeout(ftnlun[lun]->s, buffer, 2*LONGSIZE, RFIO_CTRL_TIMEOUT) != (2*LONGSIZE)) { TRACE(2, "rfio" ,"rfio_xywrite: read(): ERROR occured (errno=%d)", errno); END_TRACE(); if ( serrno ) return ( serrno ); else return(errno); } p = buffer; unmarshall_LONG(p, status); unmarshall_LONG(p, rcode); TRACE(1, "rfio", "rfio_xywrite: status %d, rcode %d", status, rcode); if ( rcode > SEBASEOFF ) serrno = rcode ; else rfio_errno = rcode; return(*irc = status); } /* * Fortran wrapper */ #if (defined(hpux) && !defined(PPU)) || (defined(_AIX) && !defined(EXTNAME)) #define xywrit_ xywrit #endif /* hpux && !PPU || AIX && !EXTNAME */ #if defined(_WIN32) void DLL_DECL _stdcall XYWRIT(flun, fbuf, fnrec, fnwrit, fchopt, fchoptl, firc) #else void xywrit_(flun, fbuf, fnrec, fnwrit, fchopt, firc, fchoptl) #endif int *flun, *fnrec, *fnwrit, *firc; char *fbuf, *fchopt; int fchoptl; { char *chopt; /* xywrite options */ int status; /* xywrite return status */ INIT_TRACE("RFIO_TRACE"); if ((chopt = malloc((unsigned) fchoptl+1)) == NULL) { *firc = -errno; END_TRACE(); return; } strncpy(chopt, fchopt, fchoptl); chopt[fchoptl] = '\0'; TRACE(1, "rfio", "XYWRIT(%d, %x, %d, %d, %s, %x)", *flun, fbuf, *fnrec, *fnwrit, chopt, firc); status = rfio_xywrite(*flun, fbuf, *fnrec, *fnwrit, chopt, firc); if (status) *firc = -status; /* system errors have precedence */ TRACE(1, "rfio", "XYWRIT: status: %d, irc: %d",status,*firc); END_TRACE(); (void) free(chopt); return; } lcgdm-1.10.0/rfio/rfio_msymlink.man0000644000175000017500000000021710222773541016540 0ustar ellertellert.so ./rfio_symlink.man .\" @(#)$RCSfile: rfio_msymlink.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Damien Durand lcgdm-1.10.0/rfio/preseek64.c0000644000175000017500000001175611544122040015135 0ustar ellertellert/* * $Id: preseek64.c 4218 2011-03-28 15:07:12Z baud $ */ /* * Copyright (C) 1990-2011 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: preseek64.c,v $ $Revision: 4218 $ $Date: 2011-03-28 17:07:12 +0200 (Mon, 28 Mar 2011) $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy"; #endif /* not lint */ /* preseek64.c Remote File I/O - preseeking. */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #ifdef linux #include #endif #include "rfio.h" #include "rfio_rfilefdt.h" #include /* malloc prototype */ #ifndef min #define min(a,b) (((a)<(b)) ? (a):(b)) #endif /* * Remote file seek */ int DLL_DECL rfio_preseek64(s,iov,iovnb) int s ; int iovnb ; struct iovec64 *iov ; { int s_index; char * p ; /* Pointer to buffer */ int i ; /* Loop index */ int temp = 0 ; /* Temporary buffer exists ? */ char *trp= NULL ; /* Pointer to temporary buffer */ char rfio_buf[BUFSIZ]; INIT_TRACE("RFIO_TRACE") ; TRACE(1,"rfio","rfio_preseek64(%d, %x, %d)",s,iov,iovnb) ; /* * The file is local. * Nothing has to be done. */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1 ) { END_TRACE() ; return 0 ; } /* * Checking magic number */ if ( rfilefdt[s_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(s_index); (void) close(s); END_TRACE(); return -1 ; } /* * Nothing specified. */ if ( iovnb == 0 ) { END_TRACE() ; return 0 ; } for(i= 0; ireadissued || rfilefdt[s_index]->preseek) && rfilefdt[s_index]->lseekhow == -1 ) { rfilefdt[s_index]->lseekhow= SEEK_SET ; rfilefdt[s_index]->lseekoff64= rfilefdt[s_index]->offset64 ; } /* * Resetting flags. * preseek() is forbidden when RFIO aren't buffered. */ rfilefdt[s_index]->eof= 0 ; rfilefdt[s_index]->preseek= 0 ; rfilefdt[s_index]->nbrecord= 0 ; rfilefdt[s_index]->readissued= 0 ; if ( rfilefdt[s_index]->_iobuf.base ) { rfilefdt[s_index]->_iobuf.count= 0 ; rfilefdt[s_index]->_iobuf.ptr= iodata(rfilefdt[s_index]) ; } else { errno= EINVAL ; END_TRACE() ; return -1 ; } /* * Is rfio_buf large enough to contain the request ? * If not a temporary buffer is allocated. * THe request is then sent. */ if ( (BUFSIZ-RQSTSIZE)/(HYPERSIZE+LONGSIZE) < iovnb ) { temp= 1 ; if ((trp= (char *)malloc(RQSTSIZE+(HYPERSIZE+LONGSIZE)*iovnb)) == NULL) return -1 ; } else { trp= rfio_buf ; } p= trp ; marshall_WORD(p,RFIO_MAGIC) ; marshall_WORD(p,RQST_PRESEEK64) ; marshall_LONG(p,rfilefdt[s_index]->_iobuf.dsize) ; marshall_LONG(p,iovnb) ; p= trp + RQSTSIZE ; for(i= 0; i_iobuf.hsize + rfilefdt[s_index]->_iobuf.dsize ; TRACE(2, "rfio", "rfio_preseek64: reading %d bytes",msgsiz) ; if (netread_timeout(s,rfilefdt[s_index]->_iobuf.base,msgsiz,RFIO_CTRL_TIMEOUT) != msgsiz) { TRACE(2,"rfio","rfio_preseek64: read(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } p= rfilefdt[s_index]->_iobuf.base ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p,rcode) ; unmarshall_LONG(p,msgsiz) ; switch(req) { case RQST_FIRSTSEEK: rfio_errno = rcode ; TRACE(1,"rfio","rfio_preseek64: status %d, rcode %d",status,rcode) ; if ( status == -1 ) { END_TRACE() ; return -1 ; } rfilefdt[s_index]->preseek= ( status == iovnb ) ? 2 : 1 ; rfilefdt[s_index]->nbrecord= status ; rfilefdt[s_index]->_iobuf.ptr= iodata(rfilefdt[s_index]) ; rfilefdt[s_index]->_iobuf.count= 0 ; END_TRACE() ; return 0 ; case RQST_PRESEEK64: case RQST_LASTSEEK: case RQST_READAHD64: break ; default: TRACE(1,"rfio","rfio_preseek64(): Bad control word received") ; serrno= SEINTERNAL ; END_TRACE() ; return -1 ; } } } lcgdm-1.10.0/rfio/misc.c0000644000175000017500000000121510222773541014257 0ustar ellertellert/* * $Id: misc.c,v 1.1 2005/03/31 13:13:01 baud Exp $ */ /* * Copyright (C) 1990-1999 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: misc.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:01 $ CERN/IT/PDP/DM Frederic Hemmer"; #endif /* not lint */ /* misc.c Remote File I/O - Miscellaneous utility functions */ #define RFIO_KERNEL 1 /* system part of Remote File I/O */ #include #include void DLL_DECL striptb(s) /* Strip trailing blanks */ char *s; { register int i; for (i=strlen(s)-1;s[i]==' ';i--); s[i+1]='\0'; } lcgdm-1.10.0/rfio/rfio_fstat.man0000644000175000017500000000021110222773541016010 0ustar ellertellert.so ./rfio_stat.man .\" @(#)$RCSfile: rfio_fstat.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:02 $ CERN IT-PDP/DM Jean-Philippe Baud lcgdm-1.10.0/rfio/rfio_munlink.man0000644000175000017500000000021510222773541016350 0ustar ellertellert.so ./rfio_unlink.man .\" @(#)$RCSfile: rfio_munlink.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Damien Durand lcgdm-1.10.0/rfio/fchown.c0000644000175000017500000000751110222773541014615 0ustar ellertellert/* * $Id: fchown.c,v 1.1 2005/03/31 13:13:00 baud Exp $ */ /* * Copyright (C) 2002 by CERN/IT/DS/HSM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: fchown.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:00 $ CERN/IT/DS/HSM Jean-Philippe Baud"; #endif /* not lint */ /* fchown.c Remote File I/O - change ownership of a file */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rfilefdt.h" #include /* malloc prototype */ /* * Remote file chown */ int DLL_DECL rfio_fchown(s, owner, group) int s; int owner ; /* Owner's uid */ int group ; /* Owner's gid */ { int status ; char * p ; char * trp ; int temp=0 ; char rfio_buf[BUFSIZ]; int s_index = -1; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_fchown(%d, %d, %d)", s, owner, group); /* * The file is local */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1) { TRACE(2, "rfio", "rfio_fchown: using local fchown(%d, %d, %d)", s, owner, group); status = fchown(s, owner, group); if ( status < 0 ) serrno = 0; rfio_errno = 0; END_TRACE(); return(status); } /* * Checking magic number. */ if (rfilefdt[s_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(s_index); (void) close(s) ; END_TRACE(); return(-1); } /* * Sending request. */ p= rfio_buf ; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_FCHOWN); marshall_WORD(p, owner); marshall_WORD(p, group); TRACE(2,"rfio","rfio_fchown: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(s,rfio_buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio", "rfio_fchown: write(): ERROR occured (errno=%d)", errno); END_TRACE(); return(-1); } /* * Getting data from the network. */ for(;;) { WORD req ; LONG rcode ; LONG msgsiz ; TRACE(2, "rfio", "rfio_fchown: reading %d bytes",rfilefdt[s_index]->_iobuf.hsize) ; if (netread_timeout(s,rfio_buf,rfilefdt[s_index]->_iobuf.hsize,RFIO_DATA_TIMEOUT) != rfilefdt[s_index]->_iobuf.hsize) { TRACE(2, "rfio", "rfio_fchown: read(): ERROR occured (errno=%d)", errno); if ( temp ) (void) free(trp) ; END_TRACE() ; return(-1); } p = rfio_buf ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; unmarshall_LONG(p, msgsiz) ; switch(req) { case RQST_FCHOWN: rfio_errno= rcode ; if ( temp ) (void) free(trp) ; TRACE(1,"rfio","rfio_fchown: return status %d, rcode %d",status,rcode) ; END_TRACE() ; return(status) ; case RQST_READAHEAD: case RQST_LASTSEEK: case RQST_PRESEEK: /* * At this point a temporary buffer may need to be created * to receive data which is going to be thrown away. */ if ( temp == 0 ) { if ( rfilefdt[s_index]->_iobuf.base==NULL || rfilefdt[s_index]->_iobuf.dsize /* malloc prototype */ /* * Remote file stat */ int DLL_DECL rfio_fstat64(s, statbuf) int s; struct stat64 *statbuf; { int status ; char * p ; char * trp ; int temp=0 ; char rfio_buf[BUFSIZ]; int s_index = -1; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_fstat64(%d, %x)", s, statbuf); /* * The file is local */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1) { TRACE(2, "rfio", "rfio_fstat64: using local fstat(%d, %x)", s, statbuf); status = fstat64(s, statbuf); if ( status < 0 ) serrno = 0; rfio_errno = 0; END_TRACE(); return(status); } /* * Checking magic number. */ if (rfilefdt[s_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(s_index); (void) close(s) ; END_TRACE(); return(-1); } /* * Sending request. */ p= rfio_buf ; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_FSTAT64); TRACE(2,"rfio","rfio_fstat64: sending %d bytes", RQSTSIZE, rfilefdt[s_index]->lseekhow); if (netwrite_timeout(s,rfio_buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio", "rfio_fstat64: write(): ERROR occured (errno=%d)", errno); END_TRACE(); return(-1); } /* * Getting data from the network. */ for(;;) { WORD req ; LONG rcode ; LONG msgsiz ; int n ; TRACE(2, "rfio", "rfio_fstat64: reading %d bytes",rfilefdt[s_index]->_iobuf.hsize) ; n = netread_timeout(s,rfio_buf,rfilefdt[s_index]->_iobuf.hsize,RFIO_DATA_TIMEOUT); if (n != rfilefdt[s_index]->_iobuf.hsize) { TRACE(2, "rfio", "rfio_fstat64: read(): ERROR occured (errno=%d)", errno); if ( temp ) (void) free(trp) ; END_TRACE() ; return -1 ; } p = rfio_buf ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; unmarshall_LONG(p,msgsiz) ; switch(req) { case RQST_FSTAT64: TRACE(2, "rfio", "rfio_fstat64: reading %d bytes",msgsiz); if (netread_timeout(s,rfio_buf,msgsiz,RFIO_DATA_TIMEOUT) != msgsiz ) { TRACE(2,"rfio","rfio_fstat64: read(): ERROR occured (errno=%d)",errno) ; if ( temp ) (void) free(trp) ; END_TRACE() ; return -1 ; } p = rfio_buf ; unmarshall_WORD(p,statbuf->st_dev); unmarshall_HYPER(p,statbuf->st_ino); unmarshall_WORD(p,statbuf->st_mode); unmarshall_WORD(p,statbuf->st_nlink); unmarshall_WORD(p,statbuf->st_uid); unmarshall_WORD(p,statbuf->st_gid); unmarshall_HYPER(p,statbuf->st_size); unmarshall_LONG(p,statbuf->st_atime); unmarshall_LONG(p,statbuf->st_mtime); unmarshall_LONG(p,statbuf->st_ctime); #if !defined(_WIN32) if ( msgsiz > (5*WORDSIZE+3*LONGSIZE+2*HYPERSIZE) ) { unmarshall_LONG(p, statbuf->st_blksize); unmarshall_HYPER(p, statbuf->st_blocks); } else { statbuf->st_blksize = 0; statbuf->st_blocks = 0; } #endif rfio_errno= rcode ; if ( temp ) (void) free(trp) ; TRACE(1,"rfio","rfio_fstat64: return status %d, rcode %d", status, rcode) ; END_TRACE() ; return status ; case RQST_READAHEAD: case RQST_READAHD64: case RQST_LASTSEEK: case RQST_PRESEEK: case RQST_PRESEEK64: /* * At this point a temporary buffer may need to be created * to receive data which is going to be thrown away. */ if ( temp == 0 ) { if ( rfilefdt[s_index]->_iobuf.base==NULL || rfilefdt[s_index]->_iobuf.dsize DPMSHAREDIR = FileName($(SHAREDIR),lcgdm) NOMORERFIO = FileName(OperatorDir,nomorerfio) INCLUDES = FileName(..,h) TOPLIBRARYNAME = TopLibraryName SPOOL = RfioSpool LOGFILE = FileName($(SPOOL),rfiod.log) #if BuildNameServerLibrary CNS_ROOT_DIR = NsRoot CNS_ROOT = -DCNS_ROOT=\"$(CNS_ROOT_DIR)\" #endif ERFIODSCRIPT = FileName(FileName(FileName($(EXPORTSHR),etc),init.d),rfiod.scripts) #if FollowRtLinks FOLLOWLINKS=-DFollowRtLinks #endif #if ClientLogging LOGGINGO=logging.Osuf DUMPLOG=ProgramTargetName(dump_log) DUMPINSTALL=FileName($(BIN),ProgramTargetName(dump_log)) CLIENTLOG=-DCLIENTLOG #endif #if defined(__osf__) && defined(__alpha) && (OSMajorVersion == 4) #if RFIODaemonRealTime RTFLAGS=-non_shared RTLIBS=-L/usr/ccs/lib -lrt #endif #endif #ifdef RfioAlarmFile RFIO_ALRM= FileName(RfioSpool,RfioAlarmFile) #endif #ifdef StagerSuperUser STAGERSUPERUSER0 = StagerSuperUser STAGERSUPERUSER = -DSTAGERSUPERUSER=\"$(STAGERSUPERUSER0)\" #endif #ifdef StagerSuperGroup STAGERSUPERGROUP0 = StagerSuperGroup STAGERSUPERGROUP = -DSTAGERSUPERGROUP=\"$(STAGERSUPERGROUP0)\" #endif RFIOFLAGS=-DNOMORERFIO=\"$(NOMORERFIO)\" $(FOLLOWLINKS) \ -DLOGFILE=\"$(LOGFILE)\" \ -DRFIO_ALRM=\"$(RFIO_ALRM)\" $(CNS_ROOT) $(STAGERSUPERUSER) $(STAGERSUPERGROUP) CTHREAD_FLAGS = $(MTCCFLAGS) #if !defined(_WIN32) COMM COMM Uncomment the following to compile in debug mode RFIO package COMM DEBUG = -g COMM #endif #ifdef NfsRoot NFSROOT0 = NfsRoot NFSROOT = -DNFSROOT=\"$(NFSROOT0)\" #endif #if BuildSecurity CSEC = -DCSEC LIBCSEC = -ldl #if UseVirtualIds VIDFLAG = -DVIRTUAL_ID #endif #if UseVOMS VOMSFLAG = -DUSE_VOMS #endif #endif CFLAGS = $(DEBUG) -I$(INCLUDES) $(CTHREAD_FLAGS) $(CLIENTLOG) $(CCOPTFLAGS) $(DEFCFLAGS) $(RFIOFLAGS) $(ACCTFLAG) -DFORTRAN $(CPPUFL) $(NFSROOT) $(CSEC) $(VIDFLAG) $(VOMSFLAG) #if _WIN32 NTSERVICEO=service.obj #endif FFLAGS = $(FFOPTFLAGS) $(FPPUFL) #if defined(__alpha) && defined(__osf__) LDLIBS = -no_so -L../shlib -l$(TOPLIBRARYNAME) -llcgdm -so_archive #else #if linux LDLIBS = -L../shlib -l$(TOPLIBRARYNAME) $(LIBCSEC) -llcgdm -lnsl $(MTLDLIBS) #else #if SOLARIS LDLIBS = -L../shlib -l$(TOPLIBRARYNAME) -llcgdm -lsocket -lnsl #else #if sgi LDLIBS = -L../shlib -l$(TOPLIBRARYNAME) -llcgdm $(MTLDLIBS) #else #if __Lynx__ LDLIBS = -L../shlib -l$(TOPLIBRARYNAME) -llcgdm -lnsl -lbsd #else #if _WIN32 LDLIBS = ..\lib\$(TOPLIBRARYNAME).lib ws2_32.lib advapi32.lib mpr.lib #else LDLIBS = -L../shlib -l$(TOPLIBRARYNAME) -llcgdm $(MTLDLIBS) #endif #endif #endif #endif #endif #endif #if _WIN32 RFIOLIB = rfio.lib #else RFIOLIB = #endif LIBS = $(OPTLIBS) .PRECIOUS: LibraryTargetName(rfio) #if BuildRfioServer MANPAGESSERVER = FileName($(DMONMANDIR),rfiod.$(DMONMANSUFFIX)) #endif #if BuildRfioClient MANPAGESCLIENT = FileName($(MANDIR),rfcat.$(MANSUFFIX)) \ FileName($(MANDIR),rfchmod.$(MANSUFFIX)) \ FileName($(MANDIR),rfcp.$(MANSUFFIX)) \ FileName($(MANDIR),rfdf.$(MANSUFFIX)) \ FileName($(MANDIR),rfdir.$(MANSUFFIX)) \ FileName($(MANDIR),rfmkdir.$(MANSUFFIX)) \ FileName($(MANDIR),rfrename.$(MANSUFFIX)) \ FileName($(MANDIR),rfrm.$(MANSUFFIX)) \ FileName($(MANDIR),rfstat.$(MANSUFFIX)) \ FileName($(LIBMANDIR),rfio_access.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_chmod.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_chown.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_close.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_closedir.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_fchmod.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_fclose.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_feof.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_ferror.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_fflush.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_fileno.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_fopen.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_fopen64.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_fread.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_fseek.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_fseeko64.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_fstat.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_fstat64.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_ftell.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_ftello64.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_fwrite.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_lockf.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_lockf64.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_lseek.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_lseek64.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_lstat.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_lstat64.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_mkdir.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_mstat.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_mstat64.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_munlink.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_msymlink.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_open.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_open64.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_opendir.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_pclose.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_perror.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_popen.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_pread.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_preseek.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_preseek64.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_pwrite.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_rcp.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_read.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_readdir.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_readlink.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_rename.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_rewinddir.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_rmdir.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_serror.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_setbufsize.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_stat.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_stat64.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_statfs.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_statfs64.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_symlink.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_unlink.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfio_write.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfioreadopt.$(LIBMANSUFFIX)) \ FileName($(LIBMANDIR),rfiosetopt.$(LIBMANSUFFIX)) #endif EXPORTMANPAGES = FileName($(EXPORTMAN),FileName(man$(MANSUFFIX),rfiod.$(MANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(MANSUFFIX),rfcat.$(MANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(MANSUFFIX),rfchmod.$(MANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(MANSUFFIX),rfcp.$(MANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(MANSUFFIX),rfdf.$(MANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(MANSUFFIX),rfdir.$(MANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(MANSUFFIX),rfmkdir.$(MANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(MANSUFFIX),rfrename.$(MANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(MANSUFFIX),rfrm.$(MANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(MANSUFFIX),rfstat.$(MANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_access.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_chmod.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_chown.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_close.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_closedir.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_fchmod.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_fclose.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_feof.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_ferror.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_fflush.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_fileno.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_fopen.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_fopen64.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_fread.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_fseek.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_fseeko64.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_fstat.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_fstat64.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_ftell.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_ftello64.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_fwrite.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_lockf.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_lockf64.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_lseek.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_lseek64.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_lstat.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_lstat64.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_mkdir.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_mstat.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_mstat64.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_munlink.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_msymlink.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_open.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_open64.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_opendir.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_pclose.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_perror.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_popen.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_pread.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_preseek.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_preseek64.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_pwrite.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_rcp.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_read.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_readdir.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_readlink.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_rename.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_rewinddir.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_rmdir.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_serror.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_setbufsize.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_stat.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_stat64.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_statfs.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_statfs64.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_symlink.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_unlink.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfio_write.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfioreadopt.$(LIBMANSUFFIX))) \ FileName($(EXPORTMAN),FileName(man$(LIBMANSUFFIX),rfiosetopt.$(LIBMANSUFFIX))) #if BuildRfioClient CLIENT = LibraryTargetName(rfio) \ ProgramTargetName(rfcat) ProgramTargetName(rfchmod) \ ProgramTargetName(rfcp) ProgramTargetName(rfdf) \ ProgramTargetName(rfdir) \ ProgramTargetName(rfmkdir) ProgramTargetName(rfrename) \ ProgramTargetName(rfrm) ProgramTargetName(rfstat) IPROGC = FileName($(BIN),ProgramTargetName(rfcat)) \ FileName($(BIN),ProgramTargetName(rfchmod)) \ FileName($(BIN),ProgramTargetName(rfcp)) \ FileName($(BIN),ProgramTargetName(rfdf)) \ FileName($(BIN),ProgramTargetName(rfdir)) \ FileName($(BIN),ProgramTargetName(rfmkdir)) \ FileName($(BIN),ProgramTargetName(rfrename)) \ FileName($(BIN),ProgramTargetName(rfrm)) \ FileName($(BIN),ProgramTargetName(rfstat)) EPROGC = FileName($(EXPORTBIN),rfcat) \ FileName($(EXPORTBIN),rfchmod) \ FileName($(EXPORTBIN),rfcp) \ FileName($(EXPORTBIN),rfdf) \ FileName($(EXPORTBIN),rfdir) \ FileName($(EXPORTBIN),rfmkdir) \ FileName($(EXPORTBIN),rfrename) \ FileName($(EXPORTBIN),rfrm) \ FileName($(EXPORTBIN),rfstat) #endif #if BuildRfioServer SERVER = ProgramTargetName(rfiod) \ rc.rfiod \ rfiod.conf.templ \ rfiod.logrotate IPROGS = FileName($(SBIN),ProgramTargetName(rfiod)) \ FileName($(INITRCDIR),rfiod) \ FileName($(SYSCONFDIR),rfiod) \ FileName($(LOGROTATEDIR),rfiod) EPROGS = FileName($(EXPORTBIN),rfiod) #endif SRVOBJS = $(NTSERVICEO) Csemaphore.Osuf rfio_serv.Osuf rfio_calls.Osuf \ rfio_call64.Osuf rfio_fcalls.Osuf rfio_callhandlers.Osuf switch_req.Osuf \ checkkey.Osuf fio.Osuf rfstatfs.Osuf alrm.Osuf \ rfioacct.Osuf RFIOLIB_OBJS = access.Osuf alrm.Osuf chdir.Osuf checkkey.Osuf chmod.Osuf \ chown.Osuf close.Osuf closedir.Osuf connect.Osuf error.Osuf \ fchmod.Osuf fchown.Osuf fclose.Osuf feof.Osuf ferror.Osuf \ fflush.Osuf fileno.Osuf fio.Osuf fopen.Osuf \ fread.Osuf fseek.Osuf fstat.Osuf ftell.Osuf \ fwrite.Osuf getc.Osuf getcwd.Osuf lockf.Osuf \ $(LOGGINGO) lseek.Osuf lstat.Osuf lun2fn.Osuf misc.Osuf \ mkdir.Osuf mstat.Osuf msymlink.Osuf munlink.Osuf open.Osuf opendir.Osuf parse.Osuf \ pclose.Osuf popen.Osuf pread.Osuf preseek.Osuf pwrite.Osuf \ rcp.Osuf read.Osuf readdir.Osuf readlink.Osuf rename.Osuf rewinddir.Osuf \ rfio_apiinit.Osuf rfio_auth.Osuf \ rfio_HsmIf.Osuf rfio_rdirfdt.Osuf rfio_rfilefdt.Osuf \ rfstatfs.Osuf rmdir.Osuf setopt.Osuf stat.Osuf statfs.Osuf stream.Osuf \ switch_req.Osuf symlink.Osuf unlink.Osuf write.Osuf xyclose.Osuf xyopen.Osuf \ xyread.Osuf xywrite.Osuf \ fopen64.Osuf fseeko64.Osuf fstat64.Osuf ftello64.Osuf \ lockf64.Osuf lseek64.Osuf open64.Osuf \ preseek64.Osuf read64.Osuf stream64.Osuf write64.Osuf all: $(CLIENT) $(SERVER) $(DUMPLOG) #if BuildRfioServer install: $(BIN) $(SBIN) $(DPMSHAREDIR) $(SYSCONFDIR) $(INITRCDIR) $(LOGROTATEDIR) $(IPROGC) $(IPROGS) $(SPOOL) $(DUMPINSTALL) #else install: $(BIN) $(IPROGC) $(IPROGS) $(DUMPINSTALL) #endif export: $(EPROGS) $(EPROGC) exportman: $(EXPORTMANPAGES) exportshr: $(ERFIODSCRIPT) $(ERFIODSCRIPT): rfiod.scripts -mkdir -p $(@D) -mv $(@D)/$? $(@D)/OLD$? cp $? $@ chmod 755 $@ NormalLibraryTarget(rfio,$(RFIOLIB_OBJS)) NormalProgramTarget(rfiod,$(SRVOBJS),DepLibraryTargetName(lib,$(TOPLIBRARYNAME)), \ $(MTLDFLAGS) $(RTFLAGS) $(RTLIBS) $(LDLIBS)) #if ((defined(__osf__) && defined(__alpha) && (OSMajorVersion == 4)) || defined(linux)) #if RFIODaemonRealTime rfio_calls.Osuf: rfio_calls.c $(CC) $(CFLAGS) -DRFIODaemonRealTime -c rfio_calls.c #endif #endif #if _WIN32 service.c: ..\win32\service.c RemoveFile(service.c) copy ..\win32\service.c service.c #endif rc.rfiod: rfiod.scripts sed -e 's#PREFIX=.*#PREFIX=$(prefix)#' $? > $@ rfiod.conf.templ: rfiod.sysconfig $(CP) $? $@ NormalProgramTarget(dump_log,dump_log.Osuf,DepLibraryTargetName(common,common), \ $(LDLIBS)) NormalProgramTarget(rfcat,rfcat.Osuf, \ LibraryTargetName(rfio) DepLibraryTargetName(lib,$(TOPLIBRARYNAME)),$(RFIOLIB) $(LDLIBS)) NormalProgramTarget(rfchmod,rfchmod.Osuf, \ LibraryTargetName(rfio) DepLibraryTargetName(lib,$(TOPLIBRARYNAME)),$(RFIOLIB) $(LDLIBS)) NormalProgramTarget(rfcp,rfcp.Osuf, \ LibraryTargetName(rfio) DepLibraryTargetName(lib,$(TOPLIBRARYNAME)),$(RFIOLIB) $(LDLIBS)) NormalProgramTarget(rfstat,rfstat.Osuf, \ LibraryTargetName(rfio) DepLibraryTargetName(lib,$(TOPLIBRARYNAME)),$(RFIOLIB) $(LDLIBS)) NormalProgramTarget(rfrm,rfrm.Osuf, \ LibraryTargetName(rfio) DepLibraryTargetName(lib,$(TOPLIBRARYNAME)),$(RFIOLIB) $(LDLIBS)) NormalProgramTarget(rfdf,rfdf.Osuf, \ LibraryTargetName(rfio) DepLibraryTargetName(lib,$(TOPLIBRARYNAME)),$(RFIOLIB) $(LDLIBS)) NormalProgramTarget(rfdir,rfdir.Osuf, \ LibraryTargetName(rfio) DepLibraryTargetName(lib,$(TOPLIBRARYNAME)),$(RFIOLIB) $(LDLIBS)) NormalProgramTarget(rfmkdir,rfmkdir.Osuf, \ LibraryTargetName(rfio) DepLibraryTargetName(lib,$(TOPLIBRARYNAME)),$(RFIOLIB) $(LDLIBS)) NormalProgramTarget(rfrename,rfrename.Osuf, \ LibraryTargetName(rfio) DepLibraryTargetName(lib,$(TOPLIBRARYNAME)),$(RFIOLIB) $(LDLIBS)) InstallProgram(rfiod,$(SBIN),root,bin,755) IEXPORT(rfiod,$(EXPORT)/sbin,755) InstallTargetRename(rc.rfiod,root,bin,0755,$(INITRCDIR),rfiod) InstallTargetRename(rfiod.conf.templ,root,bin,0644,$(SYSCONFDIR),rfiod) InstallTargetRename(rfiod.logrotate,root,bin,0644,$(LOGROTATEDIR),rfiod) InstallProgram(rfcat,$(BIN),root,bin,755) IEXPORT(rfcat,$(EXPORTBIN),755) InstallProgram(rfchmod,$(BIN),root,bin,755) IEXPORT(rfchmod,$(EXPORTBIN),755) InstallProgram(rfcp,$(BIN),root,bin,755) IEXPORT(rfcp,$(EXPORTBIN),755) InstallProgram(rfstat,$(BIN),root,bin,755) IEXPORT(rfstat,$(EXPORTBIN),755) InstallProgram(rfrm,$(BIN),root,bin,755) IEXPORT(rfrm,$(EXPORTBIN),755) InstallProgram(rfdf,$(BIN),root,bin,755) IEXPORT(rfdf,$(EXPORTBIN),755) InstallProgram(rfdir,$(BIN),root,bin,755) IEXPORT(rfdir,$(EXPORTBIN),755) InstallProgram(rfmkdir,$(BIN),root,bin,755) IEXPORT(rfmkdir,$(EXPORTBIN),755) InstallProgram(rfrename,$(BIN),root,bin,755) IEXPORT(rfrename,$(EXPORTBIN),755) InstallProgram(dump_log,$(BIN),root,bin,755) MakeDir($(BIN),root,bin,0755) MakeDir($(SBIN),root,bin,0755) MakeDir($(DPMSHAREDIR),root,bin,0755) MakeDir($(SPOOL),root,bin,0755) MakeDir($(SYSCONFDIR),root,bin,0755) MakeDir($(INITRCDIR),root,bin,0755) MakeDir($(LOGROTATEDIR),root,bin,0755) install.man: $(MANDIR) $(LIBMANDIR) $(MANPAGESCLIENT) $(MANPAGESSERVER) MakeDir($(MANDIR),root,bin,0755) MakeDir($(LIBMANDIR),root,bin,0755) MakeDir($(DMONMANDIR),root,bin,0755) FILTERMANPAGE(rfiod,rfiod,$(DMONMANDIR),$(DMONMANSUFFIX)) FILTERMANPAGE(rfcat,rfcat,$(MANDIR),$(MANSUFFIX)) FILTERMANPAGE(rfchmod,rfchmod,$(MANDIR),$(MANSUFFIX)) FILTERMANPAGE(rfcp,rfcp,$(MANDIR),$(MANSUFFIX)) FILTERMANPAGE(rfdf,rfdf,$(MANDIR),$(MANSUFFIX)) FILTERMANPAGE(rfdir,rfdir,$(MANDIR),$(MANSUFFIX)) FILTERMANPAGE(rfmkdir,rfmkdir,$(MANDIR),$(MANSUFFIX)) FILTERMANPAGE(rfrename,rfrename,$(MANDIR),$(MANSUFFIX)) FILTERMANPAGE(rfrm,rfrm,$(MANDIR),$(MANSUFFIX)) FILTERMANPAGE(rfstat,rfstat,$(MANDIR),$(MANSUFFIX)) FILTERMANPAGE(rfio_access,rfio_access,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_chmod,rfio_chmod,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_chown,rfio_chown,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_close,rfio_close,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_closedir,rfio_closedir,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_fchmod,rfio_fchmod,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_fclose,rfio_fclose,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_feof,rfio_feof,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_ferror,rfio_ferror,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_fflush,rfio_fflush,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_fileno,rfio_fileno,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_fopen,rfio_fopen,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_fopen64,rfio_fopen64,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_fread,rfio_fread,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_fseek,rfio_fseek,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_fseeko64,rfio_fseeko64,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_fstat,rfio_fstat,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_fstat64,rfio_fstat64,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_ftell,rfio_ftell,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_ftello64,rfio_ftello64,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_fwrite,rfio_fwrite,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_lockf,rfio_lockf,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_lockf64,rfio_lockf64,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_lseek,rfio_lseek,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_lseek64,rfio_lseek64,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_lstat,rfio_lstat,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_lstat64,rfio_lstat64,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_mkdir,rfio_mkdir,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_mstat,rfio_mstat,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_mstat64,rfio_mstat64,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_munlink,rfio_munlink,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_msymlink,rfio_msymlink,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_open,rfio_open,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_open64,rfio_open64,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_opendir,rfio_opendir,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_pclose,rfio_pclose,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_perror,rfio_perror,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_popen,rfio_popen,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_pread,rfio_pread,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_preseek,rfio_preseek,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_preseek64,rfio_preseek64,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_pwrite,rfio_pwrite,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_rcp,rfio_rcp,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_read,rfio_read,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_readdir,rfio_readdir,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_readlink,rfio_readlink,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_rename,rfio_rename,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_rewinddir,rfio_rewinddir,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_rmdir,rfio_rmdir,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_serror,rfio_serror,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_setbufsize,rfio_setbufsize,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_stat,rfio_stat,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_stat64,rfio_stat64,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_statfs,rfio_statfs,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_statfs64,rfio_statfs64,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_symlink,rfio_symlink,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_unlink,rfio_unlink,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfio_write,rfio_write,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfioreadopt,rfioreadopt,$(LIBMANDIR),$(LIBMANSUFFIX)) FILTERMANPAGE(rfiosetopt,rfiosetopt,$(LIBMANDIR),$(LIBMANSUFFIX)) EMANPAGE(rfiod,FileName($(EXPORTMAN),man$(DMONMANSUFFIX)),$(DMONMANSUFFIX)) EMANPAGE(rfcat,FileName($(EXPORTMAN),man$(MANSUFFIX)),$(MANSUFFIX)) EMANPAGE(rfchmod,FileName($(EXPORTMAN),man$(MANSUFFIX)),$(MANSUFFIX)) EMANPAGE(rfcp,FileName($(EXPORTMAN),man$(MANSUFFIX)),$(MANSUFFIX)) EMANPAGE(rfdf,FileName($(EXPORTMAN),man$(MANSUFFIX)),$(MANSUFFIX)) EMANPAGE(rfdir,FileName($(EXPORTMAN),man$(MANSUFFIX)),$(MANSUFFIX)) EMANPAGE(rfmkdir,FileName($(EXPORTMAN),man$(MANSUFFIX)),$(MANSUFFIX)) EMANPAGE(rfrename,FileName($(EXPORTMAN),man$(MANSUFFIX)),$(MANSUFFIX)) EMANPAGE(rfrm,FileName($(EXPORTMAN),man$(MANSUFFIX)),$(MANSUFFIX)) EMANPAGE(rfstat,FileName($(EXPORTMAN),man$(MANSUFFIX)),$(MANSUFFIX)) EMANPAGE(rfio_access,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_chmod,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_chown,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_close,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_closedir,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_fchmod,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_fclose,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_feof,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_ferror,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_fflush,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_fileno,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_fopen,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_fopen64,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_fread,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_fseek,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_fseeko64,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_fstat,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_fstat64,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_ftell,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_ftello64,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_fwrite,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_lockf,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_lockf64,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_lseek,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_lseek64,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_lstat,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_lstat64,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_mkdir,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_mstat,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_mstat64,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_munlink,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_msymlink,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_open,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_open64,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_opendir,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_pclose,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_perror,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_popen,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_pread,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_preseek,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_preseek64,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_pwrite,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_rcp,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_read,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_readdir,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_readlink,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_rename,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_rewinddir,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_rmdir,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_serror,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_setbufsize,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_stat,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_stat64,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_statfs,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_statfs64,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_symlink,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_unlink,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfio_write,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfioreadopt,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) EMANPAGE(rfiosetopt,FileName($(EXPORTMAN),man$(LIBMANSUFFIX)),$(LIBMANSUFFIX)) clean: @echo cleaning in CurDir -@RemoveFiles(FilesToClean) clobber: clean @echo clobbering in CurDir -@RemoveFiles($(CLIENT) $(SERVER) $(DUMPLOG)) #if _WIN32 depend: @echo Not supported on this platform #else depend: makedepend -Y$(INCLUDES) *.c 2> /dev/null #endif Makefiles: MakeDepLibrary(common,common) MakeDepLibrary(lib,$(TOPLIBRARYNAME)) FORCE: COMM COMM Dependencies COMM COMM DO NOT DELETE THIS LINE -- make depend depends on it. lcgdm-1.10.0/rfio/write64.c0000644000175000017500000001700410222773541014633 0ustar ellertellert/* * $Id: write64.c,v 1.1 2005/03/31 13:13:05 baud Exp $ */ /* * Copyright (C) 1990-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: write64.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:05 $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy, F. Hassine, Philippe Gaillardon"; #endif /* not lint */ /* write64.c Remote File I/O - write a file */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rfilefdt.h" #include /* malloc prototype */ /* * Remote file write */ int DLL_DECL rfio_write64(s, ptr, size) void *ptr; int s, size; { int s_index; /* Remote file ? */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) != -1) { if (rfilefdt[s_index]->version3 == 1) { /* New V3 stream protocol for sequential transfers */ return(rfio_write64_v3(s,(char *)ptr,size)); } else return(rfio_write64_v2(s,(char *)ptr,size)); } else return(rfio_write64_v2(s,(char *)ptr,size)); } int rfio_write64_v2(s, ptr, size) char *ptr; int s, size; { int status ; /* Return code of called func */ int HsmType, save_errno, written_to; char * p ; /* Pointer to buffer */ char * trp ; /* Pointer to a temp buffer */ int temp=0 ; /* Has it been allocated ? */ char rfio_buf[BUFSIZ]; int s_index; RFILE *rfptr; /* RFILE pointer */ INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_write64(%d, %x, %d)", s, ptr, size) ; if (size == 0) { END_TRACE(); return(0); } #if defined (CLIENTLOG) /* Client logging */ rfio_logwr(s,size); #endif /* * Check HSM type and if file has been written to. The CASTOR HSM * uses normal RFIO (local or remote) to perform the I/O. Thus we * don't call rfio_HsmIf_write(). */ HsmType = rfio_HsmIf_GetHsmType(s,&written_to); if ( HsmType > 0 ) { if ( written_to == 0 && (status = rfio_HsmIf_FirstWrite(s,ptr,size)) < 0) { END_TRACE(); return(status); } if ( HsmType != RFIO_HSM_CNS ) { status = rfio_HsmIf_write(s,ptr,size); if ( status == -1 ) rfio_HsmIf_IOError(s,errno); END_TRACE(); return(status); } } /* * The file is local. */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1) { TRACE(2, "rfio", "rfio_write: using local write(%d, %x, %d)", s, ptr, size); status = write(s, ptr, size); if ( status < 0 ) serrno = 0; if ( HsmType == RFIO_HSM_CNS ) { save_errno = errno; rfio_HsmIf_IOError(s,errno); errno = save_errno; } END_TRACE(); rfio_errno = 0; return(status); } /* least is beautiful ! */ rfptr = rfilefdt[s_index]; /* * Checking magic number. */ if (rfilefdt[s_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(s_index); (void) close(s) ; END_TRACE(); return(-1); } /* * Checking mode 64. */ if (!rfilefdt[s_index]->mode64) { status = rfio_write_v2(s, ptr, size); END_TRACE(); return(status); } /* * Repositionning file mark if needed. */ if ( (rfilefdt[s_index]->lseekhow == -1) && ( rfilefdt[s_index]->readissued || rfilefdt[s_index]->preseek ) ) { rfilefdt[s_index]->lseekhow= SEEK_SET ; rfilefdt[s_index]->lseekoff64= rfilefdt[s_index]->offset64 ; } /* * Repositionning file mark if buffered read occured. */ if ( rfptr->_iobuf.base && rfptr->_iobuf.count && (rfptr->lseekhow == -1) && (rfptr->lseekoff64 + rfptr->_iobuf.count != rfptr->offset64) ) { rfptr->lseekhow= SEEK_SET ; rfptr->lseekoff64= rfptr->offset64 ; } /* * Resetting flags */ rfilefdt[s_index]->eof= 0 ; rfilefdt[s_index]->preseek= 0 ; rfilefdt[s_index]->nbrecord= 0 ; rfilefdt[s_index]->readissued= 0 ; if ( rfilefdt[s_index]->_iobuf.base ) { rfilefdt[s_index]->_iobuf.count= 0 ; rfilefdt[s_index]->_iobuf.ptr= iodata(rfilefdt[s_index]) ; } /* * Sending request. */ p= rfio_buf ; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_WRITE64); marshall_LONG(p, size); marshall_LONG(p, rfilefdt[s_index]->lseekhow) ; p= rfio_buf + RQSTSIZE ; marshall_HYPER(p, rfilefdt[s_index]->lseekoff64) ; rfilefdt[s_index]->lseekhow= -1 ; TRACE(2, "rfio", "rfio_write64: sending %d bytes",RQSTSIZE64) ; if (netwrite_timeout(s, rfio_buf, RQSTSIZE64, RFIO_CTRL_TIMEOUT) != RQSTSIZE64) { TRACE(2,"rfio","rfio_write64: write(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } if (rfilefdt[s_index]->bufsize < size) { rfilefdt[s_index]->bufsize = size ; TRACE(2, "rfio", "rfio_write64: setsockopt(SOL_SOCKET, SO_SNDBUF): %d", rfilefdt[s_index]->bufsize) ; if (setsockopt(s,SOL_SOCKET,SO_SNDBUF,(char *)&(rfilefdt[s_index]->bufsize),sizeof((rfilefdt[s_index]->bufsize))) == -1) { TRACE(2, "rfio" ,"rfio_write64: setsockopt(SO_SNDBUF)") ; } } TRACE(2,"rfio","rfio_write64: sending %d bytes",size) ; if (netwrite_timeout(s, ptr, size, RFIO_DATA_TIMEOUT) != size) { TRACE(2,"rfio","rfio_write64: write(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } /* * Getting request answer. */ for(;;) { WORD req ; LONG rcode ; LONG msgsiz ; TRACE(2, "rfio", "rfio_write64: reading %d bytes",rfilefdt[s_index]->_iobuf.hsize) ; if (netread_timeout(s,rfio_buf,rfilefdt[s_index]->_iobuf.hsize,RFIO_DATA_TIMEOUT) != rfilefdt[s_index]->_iobuf.hsize) { TRACE(2, "rfio", "rfio_write64: read(): ERROR occured (errno=%d)", errno); if ( temp ) (void) free(trp) ; END_TRACE() ; return -1 ; } p = rfio_buf ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p,rcode) ; unmarshall_LONG(p,msgsiz) ; switch(req) { case RQST_WRITE64: rfio_errno = rcode; if ( status < 0 ) rfio_HsmIf_IOError(s,rfio_errno); if ( status < 0 && rcode == 0 ) serrno = SENORCODE ; rfilefdt[s_index]->offset64 += status ; TRACE(1,"rfio","rfio_write64: status %d, rcode %d",status,rcode) ; if ( temp ) (void) free(trp) ; END_TRACE() ; return status ; case RQST_READAHD64: case RQST_LASTSEEK: case RQST_PRESEEK64: /* * At this point, a temporary buffer may need to be created to * receive data which is going to be thrown away. */ if ( temp == 0 ) { if ( rfilefdt[s_index]->_iobuf.base==NULL || rfilefdt[s_index]->_iobuf.dsize #include #include #include #include #include #include #include #if ( defined(__osf__) && defined(__alpha) ) #include #endif #include "logging.h" #define ERR_RECORD_FULL 1 #define MAX_LSEEK 7000 #define MAX_READ 7000 #define MAX_WRITE 7000 #define MAX_OP MAX_LSEEK+MAX_READ+MAX_WRITE static OPEN_BUFFER rec_open; static ERROR_BUFFER rec_error; static RECORD_BUFFER rec_record; static OPERATION rec_op[MAX_OP]; static int cur_op; static int record_table[MAX_RECORD_TABLE]; static int length_record_table; static int lf; void rec_read(buffer,size) char *buffer; int size; { int n; if ((n = read(lf,buffer,size)) == -1) { fprintf(stderr,"Error reading logging file\n"); exit(1); } /* It's possible for size to be equal to 0 if the client has made an open with a TRUNC flag : The record table is then empty, but the dump log is not terminated */ if ((n == 0) && (size != 0)) { fprintf(stderr,"Dump terminated\n"); exit(0); } } void main(argc,argv) int argc; char *argv[]; { static char *log_filename; char *getconfent(); char date[26]; int i; int j; char buf[10]; WRITE_BUFFER wb; READ_BUFFER rb; LSEEK_BUFFER lb; char *name; short name_length; if (argc != 2) { log_filename= (char *) getconfent("RFIO", "CLIENTLOG", 0); if (log_filename == NULL ) { fprintf(stderr,"No file specified\n") ; exit(1) ; } } else /* Open the logging file See RFIO/CLIENT_LOG variable in shift.conf */ log_filename = argv[1]; if ((lf = open(log_filename,O_RDONLY)) == -1) { fprintf(stderr,"Cannot open %s\n",log_filename); exit(1); } while (1) { rec_read((char *)&rec_open,sizeof(rec_open)); if (rec_open.command != LOG_OPEN) { fprintf(stderr,"Panic : OPEN record not found\n"); exit(1); } strcpy(date,ctime(&rec_open.date)); date[24] = '\0'; rec_read((char *)&name_length,sizeof(name_length)); if ((name = malloc(name_length)) == NULL) { fprintf(stderr,"Not enough memory\n"); exit(1); } rec_read(name,name_length); printf("%08X %04X %s OPEN : Uid=%05u Local=%1d Flags=%08X Size=%08X File = %s Machine=%s Rtime=%08X Utime=%08X Stime=%08X\n", rec_open.incarnation_date, rec_open.incarnation_pid, date, rec_open.uid, rec_open.local, rec_open.flags, rec_open.size, name, rec_open.machine, rec_open.session_real_time,rec_open.session_user_time,rec_open.session_sys_time); rec_read((char *)&rec_error,sizeof(rec_error)); if (rec_error.command != LOG_ERRORS) { fprintf(stderr,"Panic : ERROR record not found\n"); exit(1); } if (rec_error.num) printf("%08X %04X %s ERROR : Num=%05u\n", rec_open.incarnation_date, rec_open.incarnation_pid, date, rec_error.num); rec_read((char *)&rec_record,sizeof(rec_record)); if (rec_record.command != LOG_RECORD) { fprintf(stderr,"Panic : RECORD TABLE record not found\n"); exit(1); } length_record_table = rec_record.length; rec_read((char *)record_table,rec_record.length * sizeof(long)); rec_read((char *)&cur_op,sizeof(int)); rec_read((char *)rec_op,cur_op * sizeof(LSEEK_BUFFER)); for (i=0;i #endif #include "rfio.h" /* Remote File I/O general definitions */ /* ** NB This does not implement a rename across hosts */ int DLL_DECL rfio_rename(fileo, filen) /* Remote rename */ char *fileo, /* remote old path */ *filen; /* remote new path */ { char buf[BUFSIZ]; /* General input/output buffer */ register int s; /* socket descriptor */ int status; /* remote rename() status */ int len; char hostnameo[MAXHOSTNAMELEN], hostnamen[MAXHOSTNAMELEN], filenameo[MAXFILENAMSIZE], filenamen[MAXFILENAMSIZE]; char *host, *path; char *p=buf; int rt, parserc ; int rcode ; int rpo, rpn; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_rename(%s, %s)", fileo, filen); *hostnameo = *hostnamen = '\0'; rpo = parserc = rfio_parseln(fileo,&host,&path,NORDLINKS); if (parserc < 0) { END_TRACE(); return(-1); } if (host != NULL) strcpy(hostnameo, host); strcpy(filenameo, path); rpn = parserc = rfio_parse(filen,&host, &path); if (parserc < 0) { END_TRACE(); return(-1); } if (host != NULL) strcpy(hostnamen, host); strcpy(filenamen, path); /* ** We do not allow a rename across hosts as this implies ** a copy (cf move(1)). This may change in the future. */ if ((!rpo && rpn) || (rpo && !rpn)) { serrno = SEXHOST; END_TRACE(); return(-1); } if (rpo && rpn) { if (strcmp(hostnameo, hostnamen) != 0) { serrno = SEXHOST; END_TRACE(); return(-1); } } if ((!rpo) && (!rpn)) { /* if not a remote file, must be local or HSM */ if ( *hostnameo != '\0' && *hostnamen != '\0' ) { /* * HSM file */ TRACE(1,"rfio","rfio_rename: %s and %s are HSM paths", filenameo,filenamen); END_TRACE(); rfio_errno = 0; return(rfio_HsmIf_rename(filenameo,filenamen)); } /* if not remote files, must be local */ TRACE(1, "rfio", "rfio_rename: using local rename(%s, %s)", filenameo, filenamen); END_TRACE(); rfio_errno = 0; status = rename(filenameo,filenamen); if ( status < 0 ) serrno = 0; return(status); } s = rfio_connect(hostnameo,&rt); if (s < 0) { END_TRACE(); return(-1); } len = strlen(filenameo) + strlen(filenamen) + 2; if ( RQSTSIZE+len > BUFSIZ ) { TRACE(2,"rfio","rfio_rename: request too long %d (max %d)", RQSTSIZE+len,BUFSIZ); END_TRACE(); (void) netclose(s); serrno = E2BIG; return(-1); } marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_RENAME); marshall_WORD(p, geteuid()); marshall_WORD(p, getegid()); marshall_LONG(p, len); p= buf + RQSTSIZE; marshall_STRING(p, filenameo); marshall_STRING(p, filenamen); TRACE(1,"rfio","rfio_rename: filenameo %s, filenamen %s", filenameo, filenamen); TRACE(2,"rfio","rfio_rename: sending %d bytes",RQSTSIZE+len) ; if (netwrite_timeout(s,buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { TRACE(2, "rfio", "rfio_rename: write(): ERROR occured (errno=%d)", errno); (void) close(s); END_TRACE(); return(-1); } p = buf; TRACE(2, "rfio", "rfio_rename: reading %d bytes", LONGSIZE); if (netread_timeout(s, buf, 2 * LONGSIZE, RFIO_CTRL_TIMEOUT) != (2 * LONGSIZE)) { TRACE(2, "rfio", "rfio_rename: read(): ERROR occured (errno=%d)", errno); (void) close(s); END_TRACE(); return(-1); } unmarshall_LONG(p, status); unmarshall_LONG(p, rcode); TRACE(1, "rfio", "rfio_rename: return %d",status); rfio_errno = rcode; (void) close(s); if (status) { END_TRACE(); return(-1); } END_TRACE(); return (0); } lcgdm-1.10.0/rfio/closedir.c0000644000175000017500000000552210222773541015135 0ustar ellertellert/* * $Id: closedir.c,v 1.1 2005/03/31 13:13:00 baud Exp $ */ /* * Copyright (C) 1990-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: closedir.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:00 $ CERN/IT/PDP/DM Olof Barring"; #endif /* not lint */ /* closedir.c Remote File I/O - close a directory */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rdirfdt.h" /* * remote directory close */ int DLL_DECL rfio_closedir(dirp) RDIR *dirp; { char rfio_buf[BUFSIZ]; WORD req ; LONG rcode ; LONG msgsiz ; int s; int status; char *p; extern RDIR *rdirfdt[MAXRFD]; int s_index; /* * Search internal table for this directory pointer */ s_index = rfio_rdirfdt_findptr(dirp,FINDRDIR_WITH_SCAN); INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_closedir(0x%x)", dirp); /* * The directory is local */ if (s_index == -1) { TRACE(2, "rfio", "rfio_closedir: check if HSM directory"); if ( rfio_HsmIf_IsHsmDirEntry((DIR *)dirp) != -1 ) { status = rfio_HsmIf_closedir((DIR *)dirp); } else { TRACE(2, "rfio", "rfio_closedir: using local closedir(0x%x)",dirp) ; #if defined(_WIN32) status = -1; serrno = SEOPNOTSUP; #else /* _WIN32 */ status= closedir((DIR *)dirp) ; if ( status < 0 ) serrno = 0; #endif /* _WIN32 */ } END_TRACE() ; return status ; } /* * Checking magic number */ s = rdirfdt[s_index]->s; if ( rdirfdt[s_index]->magic != RFIO_MAGIC ) { serrno = SEBADVERSION ; rfio_rdirfdt_freeentry(s_index); (void) close(s) ; END_TRACE(); return(-1); } /* * Sending request. */ p= rfio_buf ; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_CLOSEDIR); TRACE(2, "rfio", "rfio_closedir: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(s, rfio_buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio", "rfio_closedir: write(): ERROR occured (errno=%d)", errno); (void) rfio_dircleanup(s) ; END_TRACE() ; return -1 ; } /* * Getting data from the network. */ TRACE(2, "rfio", "rfio_closedir: reading %d bytes",WORDSIZE+3*LONGSIZE) ; if (netread_timeout(s,rfio_buf,WORDSIZE+3*LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+3*LONGSIZE)) { TRACE(2, "rfio", "rfio_closedir: read(): ERROR occured (errno=%d)", errno); (void)rfio_dircleanup(s) ; END_TRACE() ; return -1 ; } p = rfio_buf ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; unmarshall_LONG(p,msgsiz) ; rfio_errno = rcode ; (void) rfio_dircleanup(s) ; TRACE(1, "rfio", "rfio_closedir: return status=%d, rcode=%d",status,rcode) ; END_TRACE() ; return status ; } lcgdm-1.10.0/rfio/ferror.c0000644000175000017500000000301511533400617014620 0ustar ellertellert/* * $Id: ferror.c 4148 2011-03-02 08:36:31Z baud $ */ /* * Copyright (C) 1990-2011 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: ferror.c,v $ $Revision: 4148 $ $Date: 2011-03-02 09:36:31 +0100 (Wed, 02 Mar 2011) $ CERN/IT/PDP/DM Antoine Trannoy"; #endif /* not lint */ /* ferror.c Remote File I/O - tell if an error happened */ #define RFIO_KERNEL 1 /* KERNEL part of the routines */ #include "rfio.h" /* Remote File I/O general definitions */ #include "rfio_rfilefdt.h" #include int rfio_ferror(fp) RFILE * fp ; { int rc ; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_ferror(%x)", fp); if ( fp == NULL ) { errno = EBADF; END_TRACE(); return -1 ; } /* * The file is local */ if (rfio_rfilefdt_findptr(fp,FINDRFILE_WITH_SCAN) == -1 ) { rc= ferror((FILE *)fp) ; END_TRACE() ; rfio_errno = 0; return rc ; } /* * Checking magic number */ if ( fp->magic != RFIO_MAGIC) { int fps = fp->s; serrno = SEBADVERSION ; free((char *)fp); (void) close(fps) ; END_TRACE() ; return -1 ; } /* * The file is remote, using then the eof flag updated * by rfio_fread. */ #ifdef linux if ( ((RFILE *)fp)->eof & _IO_ERR_SEEN ) #else #if defined( __APPLE__) if ( ((RFILE *)fp)->eof & __SERR ) #else #ifdef __Lynx__ if ( ((RFILE *)fp)->eof & _ERR ) #else if ( ((RFILE *)fp)->eof & _IOERR ) #endif #endif #endif rc = 1 ; else rc = 0 ; END_TRACE() ; return rc ; } lcgdm-1.10.0/rfio/rfdf.c0000644000175000017500000000156411070701342014244 0ustar ellertellert#include #include #include "rfio_api.h" #include "u64subr.h" main(int argc, char **argv) { int errflg = 0; int i; struct rfstatfs64 statfsbuf; char tmpbuf[21]; if (argc == 1) { fprintf (stderr, "usage: %s path ...\n", argv[0]); exit (1); } for (i = 1; i < argc; i++) { if (rfio_statfs64 (argv[i], &statfsbuf) < 0) { fprintf (stderr, "%s: '%s': %s\n", argv[0], argv[i], rfio_serror()); errflg++; } else { printf ("%s\n", argv[i]); printf ("\tblocksize : %d\n", statfsbuf.bsize); printf ("\ttotal blocks : %s\n", i64tostr (statfsbuf.totblks, tmpbuf, 0)); printf ("\tfree blocks : %s\n", i64tostr (statfsbuf.freeblks, tmpbuf, 0)); printf ("\ttotal inodes : %s\n", i64tostr (statfsbuf.totnods, tmpbuf, 0)); printf ("\tfree inodes : %s\n", i64tostr (statfsbuf.freenods, tmpbuf, 0)); } } exit (errflg ? 1 : 0); } lcgdm-1.10.0/rfio/rfiod.logrotate0000644000175000017500000000042510375343576016221 0ustar ellertellert# # $Id: rfiod.logrotate,v 1.4 2006/02/17 12:54:22 slemaitr Exp $ # # @(#)$RCSfile: rfiod.logrotate,v $ $Revision: 1.4 $ $Date: 2006/02/17 12:54:22 $ CERN/IT/ADC/CA Jean-Damien Durand # /var/log/rfio/log { compress daily delaycompress missingok rotate 90 } lcgdm-1.10.0/rfio/fflush.c0000644000175000017500000000230411533400617014610 0ustar ellertellert/* * $Id: fflush.c 4148 2011-03-02 08:36:31Z baud $ */ /* * Copyright (C) 1990-2011 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: fflush.c,v $ $Revision: 4148 $ $Date: 2011-03-02 09:36:31 +0100 (Wed, 02 Mar 2011) $ CERN/IT/PDP/DM Antoine Trannoy"; #endif /* not lint */ /* fflush.c Remote File I/O - flush a binary file */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rfilefdt.h" #include /* * Remote file flush * If the file is remote, this is a dummy operation. */ int DLL_DECL rfio_fflush(fp) RFILE *fp; { int status; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_fflush(%x)", fp); if ( fp == NULL ) { errno = EBADF; END_TRACE(); return -1 ; } if (rfio_rfilefdt_findptr(fp,FINDRFILE_WITH_SCAN) == -1 ) { status= fflush((FILE *)fp) ; END_TRACE() ; rfio_errno = 0; return status ; } /* * Checking magic number */ if ( fp->magic != RFIO_MAGIC) { int fps = fp->s; serrno = SEBADVERSION ; free((char *)fp); (void) close(fps) ; END_TRACE() ; return -1 ; } END_TRACE(); return 0 ; } lcgdm-1.10.0/rfio/logging.h0000644000175000017500000000610210222773541014757 0ustar ellertellert/* * $Id: logging.h,v 1.1 2005/03/31 13:13:01 baud Exp $ * * $Log: logging.h,v $ * Revision 1.1 2005/03/31 13:13:01 baud * imported from CASTOR * * Revision 1.2 1999/07/20 12:48:01 jdurand * 20-JUL-1999 Jean-Damien Durand * Timeouted version of RFIO. Using netread_timeout() and netwrite_timeout * on all control and data sockets. * */ /* * Copyright (C) 1993 by CERN/CN/SW/DC * All rights reserved */ #ifndef lint /* $static char sccsid[] = "@(#)logging.h 1.1 11/15/93 CERN CN-SW/DC F. Collin" ; */ #endif /* not lint */ /* logging.h : Some definitions for logging.c A facility for logging client I/O primitives The logging filename is defined by RFIO/CLIENTLOG in shift.conf If this variable is not defined, no client logging is done To dump a client log, use dump_log */ #define FALSE 0 #define TRUE 1 #define LOG_OPEN 0 #define LOG_RECORD 1 #define LOG_LSEEK_SET 2 #define LOG_LSEEK_CUR 3 #define LOG_LSEEK_END 4 #define LOG_READ 5 #define LOG_WRITE 6 #define LOG_ERRORS 7 #define ERR_RECORD_FULL 1 #define SYSLOG_OPEN 1 #define SYSLOG_WRONG_FD 2 #define SYSLOG_WRITE 3 #define SYSLOG_CLOSE 4 #define SYSLOG_MALLOC 5 #define SYSLOG_OVERFLOW 6 typedef struct { unsigned command:3; /* LOG_OPEN */ unsigned uid:16; /* user id */ unsigned local:1; /* local or remote file operation */ int flags; /* open flags */ char machine[9]; /* Machine name if remote operation */ long date; /* Date at which open occured */ long incarnation_date; /* Unique number identifying the client application */ short incarnation_pid; int size; /* Size of the file beeing opened */ time_t session_real_time; /* Real execution time of the session */ clock_t session_user_time; /* User CPU time of the session */ clock_t session_sys_time; /* System CPU time of the session */ } OPEN_BUFFER; typedef struct { unsigned command:3; /* LOG_LSEEK_SET or CUR or END */ unsigned offset:29; /* Lseek offset */ } LSEEK_BUFFER; typedef struct { unsigned command:3; /* LOG_READ */ unsigned count:16; /* Number of successive read performed with the same record size */ unsigned record:13; /* Record size index (see record size table) */ } READ_BUFFER; typedef struct { unsigned command:3; /* LOG_WRITE */ unsigned count:16; /* Number of successive write performed with the same record size */ unsigned record:13; /* Record size index (see record size table) */ } WRITE_BUFFER; typedef union { LSEEK_BUFFER lseek; /* One item of the operation table */ READ_BUFFER read; WRITE_BUFFER write; } OPERATION; typedef struct { unsigned command:3; /* LOG_ERROR */ unsigned num:29; /* Error numbers */ } ERROR_BUFFER; typedef struct { unsigned command:3; /* LOG_RECORD */ unsigned length:29; /* Size of record size table */ } RECORD_BUFFER; #define MAX_RECORD_TABLE 128 /* The record size table is limited to 128 items */ lcgdm-1.10.0/rfio/rfcp.man0000644000175000017500000000333511531456314014614 0ustar ellertellert.\" .\" $Id: rfcp.man,v 1.1 2005/03/31 13:13:01 baud Exp $ .\" .\" @(#)$RCSfile: rfcp.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:01 $ CERN IT-PDP/DM Olof Barring, Jean-Damien Durand .\" Copyright (C) 1998-2011 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFCP 1 "$Date: 2005/03/31 13:13:01 $" CASTOR "Rfio User Commands" .SH NAME rfcp \- Remote file copy .SH SYNOPSIS .B rfcp [ .BI -s " size" ] [ .BI -v2 ] .IR filename1 .IR filename2 .br .B rfcp [ .BI -s " size" ] [ .BI -v2 ] .IR filename .IR directory .br .P On Windows only: .br .B rfcp [ .BI -a ] [ .BI -b ] [ .BI -s " size" ] [ .BI -v2 ] .BI @ command_file .SH DESCRIPTION .IX "\fLrfcp\fR" The remote file I/O copy program provides an interface to the .B shift remote file I/O daemon (rfiod) for transferring files between remote and/or local hosts. Each .IR filename or .IR directory argument is either a remote file name of the form: .IP .IB hostname : path .LP or a local file name (not containing the :/ character combination). The standard input is supported with the .BI \- character. Then directory in output is not supported. .SH OPTIONS .TP .BI \-a tells .B rfcp that the source file is ASCII text (Windows/NT only) .TP .BI \-b tells .B rfcp that the source is a binary file (Windows/NT only) .TP .BI \-s " size" If specified, only .I size bytes will be copied .TP .BI \-v2 If specified, forces the RFIO V.2 protocol. Otherwise, V.3 (streaming mode) is used. .SH RETURN CODES \ .br 0 Ok. .br 1 Bad parameter. .br 2 System error. .br 3 Unknown error. .br 16 Device or resource busy. .br 28 No space left on device. .br 196 Request killed. .br 198 Stager not active. .br 200 Bad checksum. .SH SEE ALSO .BR rcp(1), .BR rfiod(1) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/read64.c0000644000175000017500000004320311433144506014412 0ustar ellertellert/* * $Id: read64.c 3750 2010-08-19 06:03:50Z baud $ */ /* * Copyright (C) 1990-2010 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: read64.c,v $ $Revision: 3750 $ $Date: 2010-08-19 08:03:50 +0200 (Thu, 19 Aug 2010) $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy, F. Hassine, P. Gaillardon"; #endif /* not lint */ /* read64.c Remote File I/O - read a file */ #include /* system logger */ #include #include /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rfilefdt.h" #include "u64subr.h" /* Forward reference */ static int rfio_preread64(); /* * Remote file read */ int DLL_DECL rfio_read64(s, ptr, size) void *ptr; int s, size; { int s_index; /* Remote file ? */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) != -1) { if (rfilefdt[s_index]->version3 == 1) { /* New V3 stream protocol for sequential transfers */ return(rfio_read64_v3(s,(char *)ptr,size)); } else return(rfio_read64_v2(s,(char *)ptr,size)); } else return(rfio_read64_v2(s,(char *)ptr,size)); } int rfio_read64_v2(s, ptr, size) char *ptr; int s, size; { int status ; /* Status and return code from remote */ int HsmType, save_errno; int nbytes ; /* Bytes still to read */ int s_index; char tmpbuf[21]; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_read64(%d, %x, %d)", s, ptr, size); nbytes = size; if (nbytes == 0) { END_TRACE(); return(0); } #if defined (CLIENTLOG) /* Client logging */ rfio_logrd(s,size); #endif /* * Check HSM type. The CASTOR HSM uses normal RFIO (local or remote) * to perform the I/O. Thus we don't call rfio_HsmIf_read(). */ HsmType = rfio_HsmIf_GetHsmType(s,NULL); if ( HsmType > 0 ) { if ( HsmType != RFIO_HSM_CNS ) { status = rfio_HsmIf_read(s,ptr,size); if ( status == -1 ) { save_errno = errno; rfio_HsmIf_IOError(s,errno); errno = save_errno; } END_TRACE(); return(status); } } /* * The file is local. */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1) { TRACE(2,"rfio","rfio_read: using local read(%d, %x, %d)", s, ptr, nbytes); status = read(s, ptr, nbytes); if ( status < 0 ) serrno = 0; if ( HsmType == RFIO_HSM_CNS ) { save_errno = errno; rfio_HsmIf_IOError(s,errno); errno = save_errno; } END_TRACE(); rfio_errno = 0; return(status); } /* * Checking magic number. */ if (rfilefdt[s_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(s_index); (void) close(s) ; END_TRACE(); return(-1); } /* * Checking mode 64. */ if (!rfilefdt[s_index]->mode64) { status = rfio_read_v2(s, ptr, size); END_TRACE(); return(status); } if ( !rfilefdt[s_index]->socset ) { char * ifce, *p ; int bufsize ; extern char * getconfent() ; extern char * getifnam() ; rfilefdt[s_index]->socset ++ ; ifce = ( char * ) getifnam(s) ; bufsize= DEFIOBUFSIZE ; if ( (p = getconfent("RFIORCVBUF", ifce , 0)) != NULL ) { if ((bufsize = atoi(p)) <= 0) { bufsize = DEFIOBUFSIZE; } } else /* reset error code */ serrno=0; /* * Set socket buffer size. */ TRACE(2, "rfio", "rfio_read64: setsockopt(SOL_SOCKET, SO_RCVBUF): for %s : %d", ifce, bufsize); if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&(bufsize), sizeof(bufsize)) == -1) { TRACE(2, "rfio" ,"rfio_read64: setsockopt(SO_RCVBUF)"); syslog(LOG_ALERT, "rfio: setsockopt(SO_RCVBUF): %s", strerror(errno)); } } /* * A preseek has been issued. If rfio_preread() does not succeed * in its search for the correct data, usual operations are done. */ if ( rfilefdt[s_index]->preseek ) { off64_t offset ; /* Saving current offset */ offset= rfilefdt[s_index]->offset64 ; status= rfio_preread64(s, ptr, size) ; if ( status != -2 ) { END_TRACE() ; return status ; } rfilefdt[s_index]->offset64 = offset ; rfilefdt[s_index]->lseekhow = SEEK_SET ; rfilefdt[s_index]->lseekoff64 = offset ; } /* * The file mark has to be repositionned. * Local flags are reset. */ if ( rfilefdt[s_index]->lseekhow != -1 ) { rfilefdt[s_index]->eof= 0 ; rfilefdt[s_index]->readissued= 0 ; if ( rfilefdt[s_index]->_iobuf.base ) { rfilefdt[s_index]->_iobuf.count= 0 ; rfilefdt[s_index]->_iobuf.ptr= iodata(rfilefdt[s_index]) ; } } /* * I/O are unbuffered. */ if ( rfilefdt[s_index]->_iobuf.base == NULL ) { /* * If the end of file has been reached, there is no * no need for sending a request across. */ if ( rfilefdt[s_index]->eof == 1 ) { END_TRACE() ; return 0 ; } /* * For unbuffered read ahead I/O, the request * size has to be always the same one. */ if ( rfilefdt[s_index]->ahead && rfilefdt[s_index]->_iobuf.dsize && rfilefdt[s_index]->_iobuf.dsize != size ) { TRACE(2,"rfio","rfio_read64: request size %d is incompatible with the previous one %d", size,rfilefdt[s_index]->_iobuf.dsize) ; errno= EINVAL ; END_TRACE() ; return -1 ; } rfilefdt[s_index]->_iobuf.dsize= size ; /* * Sending a request to fill the * user buffer. */ TRACE(2,"rfio","rfio_read64: call rfio_filbuf64(%d,%x,%d) at line %d", s,ptr,size,__LINE__); if ( (status= rfio_filbuf64(s,ptr,size)) < 0 ) { TRACE(2,"rfio","rfio_read64: rfio_filbuf64 returned %d",status); rfilefdt[s_index]->readissued= 0 ; if ( HsmType == RFIO_HSM_CNS ) rfio_HsmIf_IOError(s,(rfio_errno > 0 ? rfio_errno : serrno)); END_TRACE() ; return status ; } TRACE(2,"rfio","rfio_read64: rfio_filbuf64 returned %d",status); rfilefdt[s_index]->offset64 += status ; if ( status != size ) { TRACE(2,"rfio","rfio_read64: status=%d != size=%d, set eof",status,size); rfilefdt[s_index]->eof= 1 ; rfilefdt[s_index]->readissued= 0 ; } END_TRACE() ; return status ; } /* * I/O are buffered. */ for(;;) { int count; /* * There is still some valid data in cache. */ if ( rfilefdt[s_index]->_iobuf.count ) { count= (nbytes>rfilefdt[s_index]->_iobuf.count) ? rfilefdt[s_index]->_iobuf.count : nbytes ; TRACE(2, "rfio", "rfio_read64: copy %d cached bytes from 0X%X to 0X%X",count, rfilefdt[s_index]->_iobuf.ptr, ptr); (void) memcpy(ptr,rfilefdt[s_index]->_iobuf.ptr,count) ; ptr+= count ; nbytes -= count ; rfilefdt[s_index]->_iobuf.count -= count ; rfilefdt[s_index]->_iobuf.ptr += count ; } /* * User request has been satisfied. */ if ( nbytes == 0 ) { rfilefdt[s_index]->offset64 += size ; TRACE(2, "rfio", "rfio_read64: User request has been satisfied, size=%d, offset=%s, count=%d, s=%d, eof=%d", size,u64tostr(rfilefdt[s_index]->offset64,tmpbuf,0), rfilefdt[s_index]->_iobuf.count,s,rfilefdt[s_index]->eof); END_TRACE() ; return size ; } /* * End of file has been reached. * The user is returned what's left. */ if (rfilefdt[s_index]->eof == 1) { TRACE(2, "rfio", "rfio_read64: End of file (s=%d, eof=%d) has been reached. size=%d, nbytes=%d, offset64=%s", s,rfilefdt[s_index]->eof,size,nbytes,u64tostr(rfilefdt[s_index]->offset64,tmpbuf,0)); rfilefdt[s_index]->offset64 += size - nbytes ; END_TRACE() ; return ( size - nbytes ) ; } /* * Buffer is going to be fill up. */ rfilefdt[s_index]->_iobuf.count = 0; rfilefdt[s_index]->_iobuf.ptr = iodata(rfilefdt[s_index]); /* * If file offset is going to be moved we have to remember what the * offset should be within the new file buffer. * Note: file offset and buffer offset may be different in case * several consecutive lseek() calls has been issued between two reads. */ if ( rfilefdt[s_index]->lseekhow != -1 ) { count = rfilefdt[s_index]->offset64 - rfilefdt[s_index]->lseekoff64; } else { count = 0; } TRACE(2,"rfio","rfio_read64: call rfio_filbuf64(%d,%x,%d) at line %d", s,rfilefdt[s_index]->_iobuf.base,rfilefdt[s_index]->_iobuf.dsize,__LINE__); status= rfio_filbuf64(s,rfilefdt[s_index]->_iobuf.base,rfilefdt[s_index]->_iobuf.dsize) ; TRACE(2,"rfio","rfio_read64: rfio_filbuf64 returned %d",status); if ( status < 0 ) { rfilefdt[s_index]->readissued= 0 ; if ( HsmType == RFIO_HSM_CNS ) rfio_HsmIf_IOError(s,(rfio_errno > 0 ? rfio_errno : serrno)); END_TRACE() ; return -1 ; } if ( status != rfilefdt[s_index]->_iobuf.dsize ) { TRACE(2,"rfio","rfio_read64: dsize=%d, set eof",rfilefdt[s_index]->_iobuf.dsize); rfilefdt[s_index]->eof= 1 ; rfilefdt[s_index]->readissued= 0 ; } rfilefdt[s_index]->_iobuf.count= status ; /* * Make sure that file offset is correctly set within the buffer. * Note: file offset and buffer offset may be different in case * several consecutive lseek() calls has been issued between two reads. */ rfilefdt[s_index]->_iobuf.count -= count; rfilefdt[s_index]->_iobuf.ptr += count; } } /* * Called when working in preseek() mode. * Return code of -2 tells that rfio_preread() * has not been able to satisfy the request. */ static int rfio_preread64(s,buffer,size) int s ; char * buffer ; /* Pointer to user buffer. */ int size ; /* How many bytes do we want to read ? */ { int ncount ; int ngot ; int s_index; char tmpbuf[21]; TRACE(1,"rfio","rfio_preread64(%d,%x,%d)",s,buffer,size) ; ngot= 0 ; ncount= 0 ; if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1) { serrno = SEINTERNAL; END_TRACE() ; return -1 ; } do { char * p ; /* Pointer to data buffer. */ int status ; int rcode ; off64_t offset64; int len ; p= rfilefdt[s_index]->_iobuf.ptr ; unmarshall_HYPER(p,offset64) ; unmarshall_LONG(p,len) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p,rcode) ; /* * Data we are looking for is in the current record. */ TRACE(2,"rfio","rfio_preread64: record offset is %s and its length is %d",u64tostr(offset64,tmpbuf,0),len) ; TRACE(2,"rfio","rfio_preread64: We want to go at offset %s",u64tostr(rfilefdt[s_index]->offset64,tmpbuf,0)) ; if ( (offset64 <= rfilefdt[s_index]->offset64) && (rfilefdt[s_index]->offset64 < (offset64+len)) ) { /* * lseek() or read() returned an error. */ if ( status == -1 ) { rfio_errno= rcode ; END_TRACE() ; return -1 ; } /* * Copying data into user buffer. */ if (rfilefdt[s_index]->offset64 < (offset64+status)) { p+= rfilefdt[s_index]->offset64 - offset64 ; ncount= min(size-ngot,status-(rfilefdt[s_index]->offset64-offset64)) ; TRACE(2, "rfio", "rfio_preread64: copy %d cached bytes from 0X%X to 0X%X",ncount,p,buffer+ngot); (void) memcpy(buffer+ngot,p,ncount) ; rfilefdt[s_index]->offset64 += ncount ; ngot += ncount ; } /* * The current record is reaching the end of file. */ if ( len != status ) { TRACE(2, "rfio", "rfio_preread64: len=%d != status=%d, set eof",len,status); rfilefdt[s_index]->eof= 1 ; END_TRACE() ; return ngot ; } /* * The user request is satisfied. */ if ( ngot == size ) { END_TRACE() ; return ngot ; } } /* * Pointing to the next record. */ if ( status == -1 ) { rfilefdt[s_index]->_iobuf.ptr += HYPERSIZE + 3*LONGSIZE ; } else { rfilefdt[s_index]->_iobuf.ptr += HYPERSIZE + 3*LONGSIZE + status ; } rfilefdt[s_index]->nbrecord -- ; /* * No more data in the buffer. */ if ( rfilefdt[s_index]->nbrecord == 0 ) { WORD req ; int msgsiz ; /* * It was the last message. * No more data will be sent. */ if ( rfilefdt[s_index]->preseek == 2 ) break ; /* * Filling the buffer. */ msgsiz= rfilefdt[s_index]->_iobuf.hsize + rfilefdt[s_index]->_iobuf.dsize ; TRACE(2,"rfio","rfio_preread64: reading %d bytes",msgsiz) ; if ( netread_timeout(s,rfilefdt[s_index]->_iobuf.base,msgsiz,RFIO_CTRL_TIMEOUT) != msgsiz ) { TRACE(2,"rfio","rfio_preread64: read(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } p= rfilefdt[s_index]->_iobuf.base ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p,rcode) ; unmarshall_LONG(p,msgsiz) ; if ( status == -1 ) break ; rfilefdt[s_index]->nbrecord= status ; rfilefdt[s_index]->_iobuf.ptr= iodata(rfilefdt[s_index]) ; rfilefdt[s_index]->preseek= ( req == RQST_LASTSEEK ) ? 2 : 1 ; } } while( rfilefdt[s_index]->preseek ) ; /* * Preseek data did not satisfied the read() request. * rfio_read() will process the request. */ rfilefdt[s_index]->nbrecord= 0 ; rfilefdt[s_index]->preseek= 0 ; END_TRACE() ; return -2 ; } /* * Filling RFIO buffer. */ int rfio_filbuf64(s,buffer,size) int s ; char * buffer ; /* Pointer to the buffer. */ int size ; /* How many bytes do we want to read ? */ { int status ; int rcode ; int msgsiz ; WORD req ; char * p ; /* Pointer to buffer */ int nbytes ; /* Number of bytes to read */ int hsize ; /* Message header size */ int firstread= 0 ; /* The request has just been issued. */ char rfio_buf[BUFSIZ]; int s_index; char tmpbuf[21]; INIT_TRACE("RFIO_TRACE"); TRACE(1,"rfio","rfio_filbuf64(0X%X,%d) entered",buffer,size) ; if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) < 0) { TRACE(2,"rfio","rfio_filbuf64: rfio_rfilefdt_findentry(): ERROR occured (serrno=%d)", serrno) ; END_TRACE() ; return -1 ; } nbytes = size; hsize= rfilefdt[s_index]->_iobuf.hsize ; /* * If necessary a read request is sent. */ if ( ! rfilefdt[s_index]->readissued ) { firstread= 1 ; p= rfio_buf ; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p,(rfilefdt[s_index]->ahead)?RQST_READAHD64:RQST_READ64) ; marshall_LONG(p,size) ; marshall_LONG(p,rfilefdt[s_index]->lseekhow) ; p= rfio_buf + RQSTSIZE ; marshall_HYPER(p,rfilefdt[s_index]->lseekoff64) ; rfilefdt[s_index]->lseekhow= -1 ; TRACE(2, "rfio", "rfio_filbuf64: s=%d, s_index=%d, writing %d bytes, lseekoff64=%s", s, s_index, RQSTSIZE64, u64tostr(rfilefdt[s_index]->lseekoff64,tmpbuf,0)) ; if (netwrite_timeout(s,rfio_buf,RQSTSIZE64,RFIO_CTRL_TIMEOUT) != RQSTSIZE64) { TRACE(2,"rfio","rfio_filbuf64: write(): ERROR occured (errno=%d)", errno) ; END_TRACE() ; return -1 ; } if ( rfilefdt[s_index]->ahead ) rfilefdt[s_index]->readissued= 1 ; } /* * Reading data from network. */ do { /* * The buffer is the user buffer. * Only data can be written in it. */ if ( rfilefdt[s_index]->_iobuf.base == NULL ) { TRACE(2, "rfio", "rfio_filbuf64: reading %d bytes",hsize) ; if ( netread_timeout(s,rfio_buf,hsize,RFIO_CTRL_TIMEOUT) != hsize ) { TRACE(2,"rfio","rfio_filbuf64: read(): ERROR occured (errno=%d)", errno); END_TRACE(); return -1 ; } p= rfio_buf ; unmarshall_WORD(p,req) ; /* RQST_READ64, RQST_READAHD64 or RQST_FIRSTREAD */ unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; unmarshall_LONG(p,msgsiz) ; if ( status < 0 ) { rfio_errno= rcode ; if ( rcode == 0 ) serrno = SENORCODE ; END_TRACE() ; return -1 ; } nbytes= msgsiz ; /* Nb of bytes still to read */ p= buffer ; /* Pointer to buffer */ } else { int nread ; int nwant ; int ngot ; for(nread= 0,nwant= size+hsize; nread .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_pwrite (char *" ptr ", int " size ", int " items ", FILE *" fd ");" .SH DESCRIPTION .B rfio_pwrite stores in a file the bytes starting at .BI ptr , a pointer to the memory location in which resides the information, .BI items times .BI size bytes, using the descriptor .BI fd generated by a previous .BR rfio_popen . .SH RETURN VALUE This routine returns -1 if the operation failed or the number of items actually writen. In case of failure, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EBADF .I fd is a NULL pointer. .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SETIMEDOUT Timed out. .TP .B SEBADVERSION Version ID mismatch. .TP .B SECONNDROP Connection closed by remote end. .TP .B SECOMERR Communication error. .TP .B SENORCODE Host did not return error number. .SH SEE ALSO .BR rfio_popen(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_statfs.man0000644000175000017500000000546710313775555016225 0ustar ellertellert.\" .\" $Id: rfio_statfs.man,v 1.2 2005/09/20 12:07:09 baud Exp $ .\" .\" @(#)$RCSfile: rfio_statfs.man,v $ $Revision: 1.2 $ $Date: 2005/09/20 12:07:09 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2005 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_STATFS 3 "$Date: 2005/09/20 12:07:09 $" CASTOR "Rfio Library Functions" .SH NAME rfio_statfs \- get information about a mounted filesystem .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_statfs (const char *" path ", struct rfstatfs *" statfsbuf ");" .sp Under Linux, for large files: .br .B #define _LARGEFILE64_SOURCE .br .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_statfs64 (const char *" path ", struct rfstatfs64 *" statfsbuf ");" .sp For large files, under other systems: .br .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_statfs64 (const char *" path ", struct rfstatfs64 *" statfsbuf ");" .SH DESCRIPTION .B rfio_statfs gets information about a mounted filesystem. .TP 0.8i .I path specifies the logical pathname relative to the current directory or the full pathname of any file in this filesystem. .TP .I statfsbuf is a pointer to a rfstatfs structure: .nf .ft CW struct rfstatfs { long totblks ; /* Total number of blocks */ long freeblks ; /* Number of free blocks */ long bsize ; /* Block size */ long totnods ; /* Total number of inodes */ long freenods ; /* Number of free inodes */ }; struct rfstatfs64 { signed64 totblks ; /* Total number of blocks */ signed64 freeblks ; /* Number of free blocks */ long bsize ; /* Block size */ signed64 totnods ; /* Total number of inodes */ signed64 freenods ; /* Number of free inodes */ }; .ft .fi .P The 64 bits function must be used for large filesystems. It has the same syntax as the normal statfs function except that it uses a .B rfstatfs64 structure. .SH RETURN VALUE This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B ENOENT The named file/directory does not exist or is a null pathname. .TP .B EACCES Search permission is denied on a component of the .I path prefix. .TP .B EFAULT .I path or .I statfsbuf is a NULL pointer. .TP .B ENOTDIR A component of .I path prefix is not a directory. .TP .B ENAMETOOLONG The length of .I path exceeds .B CA_MAXPATHLEN or the length of a .I path component exceeds .BR CA_MAXNAMELEN . .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR Castor_limits(4) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_preseek64.man0000644000175000017500000000022010222773541016477 0ustar ellertellert.so ./rfio_preseek.man .\" @(#)$RCSfile: rfio_preseek64.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud lcgdm-1.10.0/rfio/rfio_pclose.man0000644000175000017500000000021310222773541016156 0ustar ellertellert.so ./rfio_popen.man .\" @(#)$RCSfile: rfio_pclose.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud lcgdm-1.10.0/rfio/rfio_auth.c0000644000175000017500000000414610370151042015300 0ustar ellertellert/* * Copyright (C) 2005 by CERN/IT/GD/SC * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rfio_auth.c,v $ $Revision: 1.2 $ $Date: 2006/02/01 15:14:58 $ CERN IT-GD/SC Jean-Philippe Baud"; #endif /* not lint */ #include #include #include #include "Castor_limits.h" #include "rfio_api.h" #include "serrno.h" #include "trace.h" /* rfio_client_getAuthorizationId - get the authorization id from the thread-specific structure */ int DLL_DECL rfio_client_getAuthorizationId(uid_t *uid, gid_t *gid, char **mech, char **id) { struct rfio_api_thread_info *thip; #ifdef CSEC if (rfio_apiinit (&thip)) return (-1); if (thip->use_authorization_id == 0) return (0); if (uid) *uid = thip->Csec_uid; if (gid) *gid = thip->Csec_gid; if (mech) *mech = thip->Csec_mech; if (id) *id = thip->Csec_auth_id; #endif return (0); } /* rfio_client_setAuthorizationId - set the authorization id in the thread-specific structure */ int DLL_DECL rfio_client_setAuthorizationId(uid_t uid, gid_t gid, const char *mech, char *id) { struct rfio_api_thread_info *thip; #ifdef CSEC INIT_TRACE ("RFIO_TRACE"); if (rfio_apiinit (&thip)) return (-1); thip->Csec_uid = uid; thip->Csec_gid = gid; if (strlen (mech) > CA_MAXCSECPROTOLEN) { TRACE (1, "rfio", "setAuthorizationId: Supplied Csec protocol is too long"); END_TRACE (); serrno = EINVAL; return (-1); } strcpy (thip->Csec_mech, mech); if (strlen (id) > CA_MAXCSECNAMELEN) { TRACE (1, "rfio", "setAuthorizationId: Supplied authorization id is too long"); END_TRACE (); serrno = EINVAL; return (-1); } strcpy (thip->Csec_auth_id, id); thip->voname = NULL; thip->nbfqan = 0; thip->fqan = NULL; thip->use_authorization_id = 1; #endif return (0); } /* rfio_client_setVOMS_data - set the VOMS data in the thread-specific structure */ int DLL_DECL rfio_client_setVOMS_data(char *voname, char **fqan, int nbfqan) { struct rfio_api_thread_info *thip; #ifdef CSEC if (rfio_apiinit (&thip)) return (-1); thip->voname = voname; thip->nbfqan = nbfqan; thip->fqan = fqan; #endif return (0); } lcgdm-1.10.0/rfio/rfio_feof.man0000644000175000017500000000021210222773541015607 0ustar ellertellert.so ./rfio_ferror.man .\" @(#)$RCSfile: rfio_feof.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:02 $ CERN IT-PDP/DM Jean-Philippe Baud lcgdm-1.10.0/rfio/rfio_lseek.man0000644000175000017500000000376610222773541016014 0ustar ellertellert.\" .\" $Id: rfio_lseek.man,v 1.1 2005/03/31 13:13:03 baud Exp $ .\" .\" @(#)$RCSfile: rfio_lseek.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2003 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_LSEEK 3 "$Date: 2005/03/31 13:13:03 $" CASTOR "Rfio Library Functions" .SH NAME rfio_lseek \- positions/repositions a file .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "off_t rfio_lseek (int " s ", off_t " offset ", int " how ");" .br .sp Under Linux, for large files: .br .B #define _LARGEFILE64_SOURCE .br .B #include .br \fB#include "rfio_api.h"\fR .br .sp .BI "off64_t rfio_lseek64 (int " s ", off64_t " offset ", int " how ");" .br .sp For large files, under other systems: .br .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "off64_t rfio_lseek64 (int " s ", off64_t " offset ", int " how ");" .SH DESCRIPTION .B rfio_lseek positions/repositions to .I offset the file associated with the descriptor .I s generated by a previous .BR rfio_open . .I how indicates how to interpret the .I offset value: .RS .TP 1.3i .B SEEK_SET The offset is set from beginning of file. .TP .B SEEK_CUR The offset is added to current position. .TP .B SEEK_END The offset is added to current file size. .RE .sp .B rfio_lseek64 performs the same function on large files using off64_t rather than off_t. .B .SH RETURN VALUE This routine returns -1 if the operation failed or the actual offset from the beginning of file. In case of failure, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EBADF .I s is not a valid descriptor. .TP .B EINVAL incorrect value for .IR how . .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SETIMEDOUT Timed out. .TP .B SEBADVERSION Version ID mismatch. .TP .B SEINTERNAL Internal error. .TP .B SECONNDROP Connection closed by remote end. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR rfio_open(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfiod.sysconfig0000644000175000017500000000265113156156735016227 0ustar ellertellert# # $Id: rfiod.sysconfig,v 1.9 2009/03/17 09:36:49 dhsmith Exp $ # # @(#)$RCSfile: rfiod.sysconfig,v $ $Revision: 1.9 $ $Date: 2009/03/17 09:36:49 $ CERN/IT/ADC/CA Jean-Damien Durand # # should rfiod run? # any string but "yes" will equivalent to "NO" # RUN_RFIOD="yes" # # should we run with another limit on the number of file descriptors than the default? # any string will be passed to ulimit -n #ULIMIT_N=4096 # ############################################################################################### # Change and uncomment the variables below if your setup is different than the one by default # ############################################################################################### ###################### # DPM RFIO variables # ###################### # - DPM Name Server host : please change !!!!!! DPNS_HOST= # - DPM host : please change !!!!!! DPM_HOST= # - RFIO log file : #RFIOLOGFILE=/var/log/rfio/log ################### # RFIO Port Range # ################### # - RFIO port range : #RFIO_PORT_RANGE="20000 25000" ################### # Globus variable # ################### # - gridmapdir location #GRIDMAPDIR=/etc/grid-security/gridmapdir X509_USER_KEY=/etc/grid-security/dpmmgr/dpmkey.pem X509_USER_CERT=/etc/grid-security/dpmmgr/dpmcert.pem export X509_USER_KEY export X509_USER_CERT ######################### # RFIOD Startup Options # ######################### #OPTIONS="-sl" lcgdm-1.10.0/rfio/alrm.c0000644000175000017500000000362612245612447014273 0ustar ellertellert/* * $Id: alrm.c,v 1.1 2005/03/31 13:12:59 baud Exp $ */ /* * Copyright (C) 1995-1999 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: alrm.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:12:59 $ CERN/IT/PDP/DM Felix Hassine"; #endif /* not lint */ #include #include #include #include #include #include #if !defined(_WIN32) #include #endif #include "log.h" #ifndef RFIO_ALRM #define RFIO_ALRM "/usr/spool/rfio/rfio_alrm" #endif #ifndef LOGSIZELIM #define LOGSIZELIM 102400 #endif extern char* getconfent () ; /* * Alarm: rfio writes in an alarm file * the buffer. The file should not exist * if there is no problem. * Returns 0 if an alarm is successfully raised, * 1 if no alarm is requested in getconfent(). * 2 if size of log file is already at its limit * -1 otherwise. * If RFIOD ALARM is 0, alarm for any code. */ int rfio_alrm(rcode,buf) int rcode ; char *buf ; { time_t clock ; int fd ; int n ; char buffer[256]; char *p ; int wrtbanner = 0 ; struct stat statb ; if ( (p= (char *)getconfent("RFIOD","ALRM",0)) == NULL ) { log(LOG_DEBUG,"rfio_alrm() entered: no alarm in getconfent() \n"); return 1 ; } if ( ( (n=atoi(p)) > 0 && n==rcode ) || n==0 ) { time(&clock) ; log(LOG_DEBUG,"rfio_alrm(): alarm %s\n",buf) ; if ( stat(RFIO_ALRM,&statb) < 0 ) { wrtbanner ++ ; } else { if (statb.st_size > LOGSIZELIM) return 2 ; } p=ctime(&clock) ; p[strlen(p)-7]='\0' ; sprintf(buffer,"%lu\t%d\t%s\t%s\n",clock,rcode,p,buf ) ; fd=open(RFIO_ALRM,O_CREAT|O_WRONLY|O_APPEND,0644) ; if ( fd < 0 ) return -1 ; if ( wrtbanner ) { char banner[64] ; sprintf(banner,"Time counter\tError #\tDate\tMessage\n") ; write (fd,banner,strlen(banner)); } write(fd,buffer,strlen(buffer)+1) ; close(fd); return 0 ; } return -1 ; } lcgdm-1.10.0/rfio/lockf.c0000644000175000017500000000531410222773541014426 0ustar ellertellert/* * $Id: lockf.c,v 1.1 2005/03/31 13:13:00 baud Exp $ */ /* * Copyright (C) 1994-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: lockf.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:00 $ CERN/IT/PDP/DM Antony Simmins"; #endif /* not lint */ /* lockf.c Remote File I/O - record locking on files */ #define RFIO_KERNEL 1 /* KERNEL part of the routines */ #include "rfio.h" /* Remote File I/O general definitions */ #include "rfio_rfilefdt.h" int DLL_DECL rfio_lockf(sd, op, siz) /* Remote lockf */ int sd, /* file descriptor */ op; /* lock operation */ long siz; /* locked region */ { static char buf[256]; /* General input/output buffer */ int status; /* remote lockf() status */ int len; char *p=buf; int rt ; int rcode ; int s_index; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_lockf(%d, %d, %ld)", sd, op, siz); /* * The file is local */ if ((s_index=rfio_rfilefdt_findentry(sd, FINDRFILE_WITHOUT_SCAN)) == -1) { TRACE(1, "rfio", "rfio_lockf: using local lockf(%d, %d, %ld)", sd, op, siz); END_TRACE(); rfio_errno = 0; status = lockf(sd,op,siz); if ( status < 0 ) serrno = 0; return(status); } /* * Checking mode 64. */ if (rfilefdt[s_index]->mode64) { off64_t siz64; siz64 = siz; status = rfio_lockf64(sd, op, siz64); END_TRACE(); return(status); } len = 2*LONGSIZE; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_LOCKF); marshall_WORD(p, geteuid()); marshall_WORD(p, getegid()); marshall_LONG(p, len); p= buf + RQSTSIZE; marshall_LONG(p, op); marshall_LONG(p, siz); TRACE(1,"rfio","rfio_lockf: op %d, siz %ld", op, siz); TRACE(2,"rfio","rfio_lockf: sending %d bytes",RQSTSIZE+len) ; if (netwrite_timeout(sd,buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { TRACE(2, "rfio", "rfio_lockf: write(): ERROR occurred (errno=%d)", errno); (void) close(sd); END_TRACE(); return(-1); } p = buf; TRACE(2, "rfio", "rfio_lockf: reading %d bytes", 2*LONGSIZE); if (netread_timeout(sd, buf, 2*LONGSIZE, RFIO_CTRL_TIMEOUT) != (2*LONGSIZE)) { TRACE(2, "rfio", "rfio_lockf: read(): ERROR occurred (errno=%d)", errno); (void) close(sd); END_TRACE(); return(-1); } unmarshall_LONG(p, status); unmarshall_LONG(p, rcode); TRACE(1, "rfio", "rfio_lockf: return %d",status); rfio_errno = rcode; if (status) { END_TRACE(); return(-1); } END_TRACE(); return (0); } lcgdm-1.10.0/rfio/statfs.c0000644000175000017500000001351110725234467014641 0ustar ellertellert/* * $Id: statfs.c,v 1.3 2007/12/04 11:25:43 dhsmith Exp $ */ /* * Copyright (C) 1990-2005 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: statfs.c,v $ $Revision: 1.3 $ $Date: 2007/12/04 11:25:43 $ CERN/IT/PDP/DM Felix Hassine"; #endif /* not lint */ /* statfs.c Remote File I/O - get file system status */ #define RFIO_KERNEL 1 #include "rfio.h" /* Remote File I/O general definitions */ int DLL_DECL rfio_statfs(path, statfsbuf) char *path; /* remote file path */ struct rfstatfs *statfsbuf; /* status buffer (subset of local used) */ { #if (defined(__alpha) && defined(__osf__)) || defined(IRIX64) || defined(__ia64__) || defined(__x86_64) || defined(__ppc64__) return (rfio_statfs64(path,(struct rfstatfs64 *)statfsbuf)); #else char buf[BUFSIZ]; /* General input/output buffer */ register int s; /* socket descriptor */ int status; int len; char *host, *filename; char *p=buf; int rt ; int rcode, parserc ; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_statfs(%s, %x)", path, statfsbuf); if (!(parserc = rfio_parse(path,&host,&filename))) { /* if not a remote file, must be local */ TRACE(1, "rfio", "rfio_statfs: using local statfs(%s, %x)", filename, statfsbuf); END_TRACE(); rfio_errno = 0; return(rfstatfs(filename , statfsbuf)); } if (parserc < 0) { END_TRACE(); return(-1); } len = strlen(path)+1; if ( RQSTSIZE+len > BUFSIZ ) { TRACE(2,"rfio","rfio_statfs: request too long %d (max %d)", RQSTSIZE+len,BUFSIZ); END_TRACE(); serrno = E2BIG; return(-1); } s = rfio_connect(host,&rt); if (s < 0) { END_TRACE(); return(-1); } marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_STATFS); marshall_LONG(p, len); p= buf + RQSTSIZE; marshall_STRING(p, filename); TRACE(2,"rfio","rfio_statfs: sending %d bytes",RQSTSIZE+len) ; if (netwrite_timeout(s,buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { TRACE(2, "rfio", "rfio_statfs: write(): ERROR occured (errno=%d)", errno); (void) close(s); END_TRACE(); return(-1); } p = buf; TRACE(2, "rfio", "rfio_statfs: reading %d bytes", 7*LONGSIZE); if (netread_timeout(s, buf, 7*LONGSIZE, RFIO_CTRL_TIMEOUT) != (7*LONGSIZE)) { TRACE(2, "rfio", "rfio_statfs: read(): ERROR occured (errno=%d)", errno); (void) close(s); END_TRACE(); return(-1); } unmarshall_LONG( p, statfsbuf->bsize ) ; unmarshall_LONG( p, statfsbuf->totblks ) ; unmarshall_LONG( p, statfsbuf->freeblks ) ; unmarshall_LONG( p, statfsbuf->totnods ) ; unmarshall_LONG( p, statfsbuf->freenods ) ; unmarshall_LONG( p, status ) ; unmarshall_LONG( p, rcode ) ; TRACE(1, "rfio", "rfio_statfs: return %d",status); rfio_errno = rcode ; (void) close(s); END_TRACE(); return (status); #endif } int DLL_DECL rfio_statfs64(path, statfsbuf) char *path; /* remote file path */ struct rfstatfs64 *statfsbuf; /* status buffer (subset of local used) */ { char buf[BUFSIZ]; /* General input/output buffer */ register int s; /* socket descriptor */ int status; int len; char *host, *filename; char *p=buf; int rc ; int save_errno, save_serrno; int rt ; int rcode, parserc ; struct rfstatfs statfsb32; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_statfs64(%s, %x)", path, statfsbuf); if (!(parserc = rfio_parse(path,&host,&filename))) { /* if not a remote file, must be local */ TRACE(1, "rfio", "rfio_statfs64: using local statfs64(%s, %x)", filename, statfsbuf); END_TRACE(); rfio_errno = 0; return(rfstatfs64(filename , statfsbuf)); } if (parserc < 0) { END_TRACE(); return(-1); } len = strlen(path)+1; if ( RQSTSIZE+len > BUFSIZ ) { TRACE(2,"rfio","rfio_statfs64: request too long %d (max %d)", RQSTSIZE+len,BUFSIZ); END_TRACE(); serrno = E2BIG; return(-1); } s = rfio_connect(host,&rt); if (s < 0) { END_TRACE(); return(-1); } marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_STATFS64); marshall_LONG(p, len); p= buf + RQSTSIZE; marshall_STRING(p, filename); TRACE(2,"rfio","rfio_statfs64: sending %d bytes",RQSTSIZE+len) ; if (netwrite_timeout(s,buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { TRACE(2, "rfio", "rfio_statfs64: write(): ERROR occured (errno=%d)", errno); (void) close(s); END_TRACE(); return(-1); } p = buf; TRACE(2, "rfio", "rfio_statfs64: reading %d bytes", 3*LONGSIZE+4*HYPERSIZE); if ((rc=netread_timeout(s, buf, 3*LONGSIZE+4*HYPERSIZE, RFIO_CTRL_TIMEOUT)) != (3*LONGSIZE+4*HYPERSIZE)) { save_errno = errno; save_serrno = serrno; #if !defined(_WIN32) if (rc == 0 || (rc<0 && errno == ECONNRESET)) #else if (rc == 0 || (rc<0 && serrno == SETIMEDOUT)) #endif TRACE(2, "rfio", "rfio_statfs64: read(): The connection with the server has been broken"); else TRACE(2, "rfio", "rfio_statfs64: read(): ERROR occured (errno=%d)", errno); (void) close(s); END_TRACE(); errno = save_errno; serrno = save_serrno; return(-1); } unmarshall_LONG( p, statfsbuf->bsize ) ; unmarshall_HYPER( p, statfsbuf->totblks ) ; unmarshall_HYPER( p, statfsbuf->freeblks ) ; unmarshall_HYPER( p, statfsbuf->totnods ) ; unmarshall_HYPER( p, statfsbuf->freenods ) ; unmarshall_LONG( p, status ) ; unmarshall_LONG( p, rcode ) ; TRACE(1, "rfio", "rfio_statfs64: return %d",status); rfio_errno = rcode ; (void) close(s); END_TRACE(); return (status); } lcgdm-1.10.0/rfio/rfio_setbufsize.man0000644000175000017500000000024711336206564017066 0ustar ellertellert.so ./rfiosetopt.man .\" @(#)$RCSfile: rfio_setbufsize.man $ $Revision: 3174 $ $Date: 2010-02-15 10:01:40 +0100 (Mon, 15 Feb 2010) $ CERN IT-GT/DMS Jean-Philippe Baud lcgdm-1.10.0/rfio/rfio_open64.man0000644000175000017500000000021210222773541016003 0ustar ellertellert.so ./rfio_open.man .\" @(#)$RCSfile: rfio_open64.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-DS/HSM Jean-Philippe Baud lcgdm-1.10.0/rfio/Csemaphore.c0000644000175000017500000001202710222773541015415 0ustar ellertellert/* * Copyright (C) 1990-2000 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "$RCSfile: Csemaphore.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:12:59 $ CERN/IT/PDP/DM"; #endif /* not lint */ /*////////////////////////////////////////////////////////////////////// // File: Csemaphore.c // -------------------------------------------------------------------- // This is a POSIX threads semaphore implementation. See the docs // at http://dis.cs.umass.edu/~wagner/threads_html/tutorial.html // for information on POSIX threads and how to use this lib. // -------------------------------------------------------------------- // Written by: Tom A. Wagner // wagner@cs.umass.edu // Multi-Agent Systems Lab // Department of Computer and Information Science // University of Massachusetts // Amherst, Massachusetts 01003. // // This code was written at the Multi-Agent Systems Lab. at the // Department of Computer Science, University of Massachusetts, // Amherst, MA 01003. // // Copyright (c) 1996 UMASS CS Dept. All rights are reserved. // // Development of this code was partially supported by: // ONR grant N00014-92-J-1450 // NSF grant IRI-9523419 // DARPA grant, RaDEO program, 70NANB6H0074 as subcontractor for // Boeing Helicoptor //////////////////////////////////// // // */ #include "Csemaphore.h" /* * function must be called prior to semaphore use. * */ void Csemaphore_init (CSemaphore * s,int value) { s->v = value; } /* * function should be called when there is no longer a need for * the semaphore. * */ void Csemaphore_destroy (CSemaphore * s) { if (Cthread_mutex_destroy ((s)) == -1) do_error ("Error destroying Csemaphore mutex"); } /* * function increments the semaphore and signals any threads that * are blocked waiting a change in the semaphore. * */ int Csemaphore_up (CSemaphore * s) { int value_after_op; tw_pthread_mutex_lock ((void *)(s)); (s->v)++; value_after_op = s->v; tw_pthread_mutex_unlock ((void *)(s)); tw_pthread_cond_signal ((void *)(s)); return( value_after_op ); } /* * function decrements the semaphore and blocks if the semaphore is * <= 0 until another thread signals a change. * */ int Csemaphore_down (CSemaphore * s) { int value_after_op; tw_pthread_mutex_lock ((void *)(s)); while (s->v <= 0) { tw_pthread_cond_wait ((void *)(s)); } (s->v)--; value_after_op = s->v; tw_pthread_mutex_unlock ((void *)(s)); return (value_after_op); } /* * function does NOT block but simply decrements the semaphore. * should not be used instead of down -- only for programs where * multiple threads must up on a semaphore before another thread * can go down, i.e., allows programmer to set the semaphore to * a negative value prior to using it for synchronization. * */ int Csemaphore_decrement (CSemaphore * s) { int value_after_op; tw_pthread_mutex_lock ((void *)(s)); s->v--; value_after_op = s->v; tw_pthread_mutex_unlock ((void *)(s)); return (value_after_op); } /* * function returns the value of the semaphore at the time the * critical section is accessed. obviously the value is not guarenteed * after the function unlocks the critical section. provided only * for casual debugging, a better approach is for the programmar to * protect one semaphore with another and then check its value. * an alternative is to simply record the value returned by semaphore_up * or semaphore_down. * */ int Csemaphore_value (CSemaphore * s) { /* not for sync */ int value_after_op; tw_pthread_mutex_lock ((void *)(s)); value_after_op = s->v; tw_pthread_mutex_unlock ((void *)(s)); return (value_after_op); } /* -------------------------------------------------------------------- */ /* The following functions replace standard library functions in that */ /* they exit on any error returned from the system calls. Saves us */ /* from having to check each and every call above. */ /* -------------------------------------------------------------------- */ int tw_pthread_mutex_unlock(void *m) { int return_value; if ((return_value = Cthread_mutex_unlock (m)) == -1) do_error ("Cthread_mutex_unlock"); return (return_value); } int tw_pthread_mutex_lock (void * m) { int return_value; if ((return_value = Cthread_mutex_lock (m)) == -1) do_error ("Cthread_mutex_lock"); return (return_value); } int tw_pthread_cond_wait (void * c) { int return_value; if ((return_value = Cthread_cond_wait (c)) == -1) do_error ("Cthread_cond_wait"); return (return_value); } int tw_pthread_cond_signal (void * c) { int return_value; if ((return_value = Cthread_cond_signal (c)) == -1) do_error ("pthread_cond_signal"); return (return_value); } /* * function just prints an error message and exits * */ void do_error (char *msg) { perror (msg); exit (1); } lcgdm-1.10.0/rfio/rfio_rfilefdt.c0000644000175000017500000000737510222773541016157 0ustar ellertellert/* * $Id: rfio_rfilefdt.c,v 1.1 2005/03/31 13:13:03 baud Exp $ */ /* * System remote file I/O */ #ifdef _WIN32 #include "Cmutex.h" #endif #define RFIO_KERNEL 1 #include #if defined(_WIN32) #define MAXHOSTNAMELEN 64 #else #include /* For MAXHOSTNAMELEN definition */ #endif #include #include "rfio.h" #include "rfio_rfilefdt.h" extern RFILE *rfilefdt[MAXRFD] ; RFILE dummyrfile; /* Used to fill with a dummy value */ /* * Seach for a free index in the rfilefdt table */ int DLL_DECL rfio_rfilefdt_allocentry(s) int s; { #ifdef _WIN32 int i; int rc; if (Cmutex_lock((void *) rfilefdt,-1) != 0) { return(-1); } /* Scan it */ for (i = 0; i < MAXRFD; i++) { if (rfilefdt[i] == NULL) { rc = i; rfilefdt[i] = &dummyrfile; goto _rfio_rfilefdt_allocentry_return; } } serrno = ENOENT; rc = -1; _rfio_rfilefdt_allocentry_return: if (Cmutex_unlock((void *) rfilefdt) != 0) { return(-1); } return(rc); #else /* _WIN32 */ return(((s >= 0) && (s < MAXRFD)) ? s : -1); #endif /* _WIN32 */ } /* * Seach for a given index in the rfilefdt table * On UNIX, if scanflag is FINDRDIR_WITH_SCAN, * a scan of table content is performed, otherwise * only boundary and content within the boundary * is performed. */ int DLL_DECL rfio_rfilefdt_findentry(s,scanflag) int s; int scanflag; { int i; #ifdef _WIN32 int rc; if (Cmutex_lock((void *) rfilefdt,-1) != 0) { return(-1); } /* Scan it */ for (i = 0; i < MAXRFD; i++) { if (rfilefdt[i] != NULL) { if (rfilefdt[i]->s == s) { rc = i; goto _rfio_rfilefdt_findentry_return; } } } serrno = ENOENT; rc = -1; _rfio_rfilefdt_findentry_return: if (Cmutex_unlock((void *) rfilefdt) != 0) { return(-1); } return(rc); #else /* _WIN32 */ if (scanflag == FINDRFILE_WITH_SCAN) { for (i = 0; i < MAXRFD; i++) { if (rfilefdt[i] != NULL) { if (rfilefdt[i]->s == s) { return(i); } } } return(-1); } else { return(((s >= 0) && (s < MAXRFD) && (rfilefdt[s] != NULL)) ? s : -1); } #endif /* _WIN32 */ } /* * Seach for a given pointer in the rfilefdt table * On UNIX, if scanflag is FINDRDIR_WITH_SCAN, * a scan of table content is performed, otherwise * only boundary and content within the boundary * is performed. */ int DLL_DECL rfio_rfilefdt_findptr(ptr,scanflag) RFILE *ptr; int scanflag; { int i; #ifdef _WIN32 int rc; if (Cmutex_lock((void *) rfilefdt,-1) != 0) { return(-1); } /* Scan it */ for (i = 0; i < MAXRFD; i++) { if (rfilefdt[i] == ptr) { rc = i; goto _rfio_rfilefdt_findentry_return; } } serrno = ENOENT; rc = -1; _rfio_rfilefdt_findentry_return: if (Cmutex_unlock((void *) rfilefdt) != 0) { return(-1); } return(rc); #else /* _WIN32 */ if (scanflag == FINDRFILE_WITH_SCAN) { for (i = 0; i < MAXRFD; i++) { if (rfilefdt[i] == ptr) { return(i); } } return(-1); } else { /* This method works only in FINDRFILE_WITH_SCAN mode */ serrno = EINVAL; return(-1); } #endif /* _WIN32 */ } /* * Free a given index in the rfilefdt table * Warning : the argument is REALLY an index */ int DLL_DECL rfio_rfilefdt_freeentry(s) int s; { #ifdef _WIN32 if (Cmutex_lock((void *) rfilefdt,-1) != 0) { return(-1); } if (rfilefdt[s] != NULL) { if (rfilefdt[s] != &dummyrfile) free(rfilefdt[s]); rfilefdt[s] = NULL; } if (Cmutex_unlock((void *) rfilefdt) != 0) { return(-1); } #else /* _WIN32 */ if ((s >= 0) && (s < MAXRFD) && (rfilefdt[s] != NULL)) { if (rfilefdt[s] != &dummyrfile) free((char *)rfilefdt[s]); rfilefdt[s] = NULL; } #endif /* _WIN32 */ return(0); } lcgdm-1.10.0/rfio/lstat.c0000644000175000017500000001503610725234467014470 0ustar ellertellert/* * $Id: lstat.c,v 1.2 2007/12/04 11:25:43 dhsmith Exp $ */ /* * Copyright (C) 1990-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: lstat.c,v $ $Revision: 1.2 $ $Date: 2007/12/04 11:25:43 $ CERN/IT/PDP/DM Felix Hassine"; #endif /* not lint */ /* lstat.c Remote File I/O - get file status */ #define RFIO_KERNEL 1 #include #include "rfio.h" #include #include static int pw_key = -1; static int old_uid_key = -1; int DLL_DECL rfio_lstat(filepath, statbuf) /* Remote file lstat */ char *filepath; /* remote file path */ struct stat *statbuf; /* status buffer */ { #if (defined(__alpha) && defined(__osf__)) return (rfio_lstat64(filepath,statbuf)); #else int lstatus; /* remote lstat() status */ #if defined(IRIX64) || defined(__ia64__) || defined(__x86_64) || defined(__ppc64__) struct stat64 statb64; if ((lstatus = rfio_lstat64(filepath,&statb64)) == 0) (void) stat64tostat(&statb64, statbuf); return (lstatus); #else register int s; /* socket descriptor */ char buf[BUFSIZ]; /* General input/output buffer */ int len; int save_errno, save_serrno; char *host, *filename; char *p=buf; int uid; int gid; int i; struct passwd *pw_tmp; struct passwd *pw = NULL; int *old_uid = NULL; int rt,rc,reqst,magic, parserc ; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_lstat(%s, %x)", filepath, statbuf); if ( Cglobals_get(&old_uid_key, (void**)&old_uid, sizeof(int)) > 0 ) *old_uid = -1; Cglobals_get(&pw_key, (void**)&pw, sizeof(struct passwd)); if (!(parserc = rfio_parseln(filepath,&host,&filename,NORDLINKS))) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file */ TRACE(1,"rfio","rfio_stat: %s is an HSM path", filename); END_TRACE(); rfio_errno = 0; return(rfio_HsmIf_stat(filename,statbuf)); } TRACE(1, "rfio", "rfio_lstat: using local lstat(%s, %x)", filename, statbuf); END_TRACE(); rfio_errno = 0; #if !defined(_WIN32) lstatus = lstat(filename,statbuf); #else lstatus = stat(filename,statbuf); #endif /* _WIN32 */ if ( lstatus < 0 ) serrno = 0; return(lstatus); } if (parserc < 0) { END_TRACE(); return(-1); } serrno = 0; magic = B_RFIO_MAGIC; reqst = RQST_LSTAT_SEC; s = rfio_connect(host,&rt); if (s < 0) { END_TRACE(); return(-1); } len = strlen(filename)+1; p = buf; marshall_WORD(p, magic); marshall_WORD(p, reqst); uid = geteuid(); gid = getegid(); if ( uid != *old_uid ) { if ( (pw_tmp = Cgetpwuid(uid) ) == NULL ) { TRACE(2, "rfio" ,"rfio_stat: Cgetpwuid(): ERROR occured (errno=%d)",errno); END_TRACE(); (void) netclose(s); return -1 ; } memcpy(pw, pw_tmp, sizeof(struct passwd)); *old_uid = uid; } len+=2*WORDSIZE + strlen(pw->pw_name) + 1; if ( RQSTSIZE+len > BUFSIZ ) { TRACE(2,"rfio","rfio_lstat: request too long %d (max %d)",RQSTSIZE+len,BUFSIZ); END_TRACE(); (void) netclose(s); serrno = E2BIG; return(-1); } marshall_LONG(p, len); p= buf + RQSTSIZE; marshall_WORD(p, uid); marshall_WORD(p, gid); marshall_STRING(p, pw->pw_name); marshall_STRING(p, filename); TRACE(2,"rfio","rfio_lstat: sending %d bytes",RQSTSIZE+len) ; if (netwrite_timeout(s,buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { TRACE(2, "rfio", "rfio_lstat: write(): ERROR occured (errno=%d)", errno); (void) netclose(s); END_TRACE(); return(-1); } p = buf; TRACE(2, "rfio", "rfio_lstat: reading %d bytes", 6*LONGSIZE+5*WORDSIZE); if ((rc = netread_timeout(s, buf, 6*LONGSIZE+5*WORDSIZE,RFIO_CTRL_TIMEOUT)) != (6*LONGSIZE+5*WORDSIZE)) { save_errno = errno, save_serrno = serrno; #if !defined(_WIN32) if (rc == 0 || (rc<0 && errno == ECONNRESET)) #else if (rc == 0 || (rc<0 && serrno == SETIMEDOUT)) #endif TRACE(2, "rfio", "rfio_lstat: read(): The connection with the server has been broken"); else TRACE(2, "rfio", "rfio_lstat: read(): ERROR occured (errno=%d)", errno); (void) netclose(s); END_TRACE(); errno = save_errno; serrno = save_serrno; return(-1); } unmarshall_WORD(p, statbuf->st_dev); unmarshall_LONG(p, statbuf->st_ino); unmarshall_WORD(p, statbuf->st_mode); unmarshall_WORD(p, statbuf->st_nlink); unmarshall_WORD(p, statbuf->st_uid); unmarshall_WORD(p, statbuf->st_gid); unmarshall_LONG(p, statbuf->st_size); unmarshall_LONG(p, statbuf->st_atime); unmarshall_LONG(p, statbuf->st_mtime); unmarshall_LONG(p, statbuf->st_ctime); unmarshall_LONG(p, lstatus); TRACE(1, "rfio", "rfio_lstat: return %d",lstatus); rfio_errno = lstatus; (void) netclose(s); if (lstatus) { END_TRACE(); return(-1); } END_TRACE(); return (0); #endif #endif } int DLL_DECL rfio_lstat64(filepath, statbuf) /* Remote file lstat */ char *filepath; /* remote file path */ struct stat64 *statbuf; /* status buffer */ { register int s; /* socket descriptor */ int status ; char *host, *filename; int rt, parserc ; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_lstat64(%s, %x)", filepath, statbuf); if (!(parserc = rfio_parseln(filepath,&host,&filename,NORDLINKS))) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file */ TRACE(1,"rfio","rfio_lstat64: %s is an HSM path", filename); END_TRACE(); rfio_errno = 0; return(rfio_HsmIf_stat64(filename,statbuf)); } TRACE(1, "rfio", "rfio_lstat64: using local lstat64(%s, %x)", filename, statbuf); END_TRACE(); rfio_errno = 0; #if !defined(_WIN32) status = lstat64(filename,statbuf); #else status = stat64(filename,statbuf); #endif /* _WIN32 */ if ( status < 0 ) serrno = 0; return(status); } if (parserc < 0) { END_TRACE(); return(-1); } s = rfio_connect(host,&rt); if (s < 0) { END_TRACE(); return(-1); } END_TRACE(); status = rfio_smstat64(s, filename, statbuf, RQST_LSTAT64) ; (void) netclose(s); return (status); } lcgdm-1.10.0/rfio/open64.c0000644000175000017500000003227711532151117014445 0ustar ellertellert/* * $Id: open64.c 4143 2011-02-26 10:13:35Z baud $ */ /* * Copyright (C) 1990-2011 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: open64.c,v $ $Revision: 4143 $ $Date: 2011-02-26 11:13:35 +0100 (Sat, 26 Feb 2011) $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy, F. Hassine, P. Gaillardon"; #endif /* not lint */ /* open64.c Remote File I/O - open file a file */ #define RFIO_KERNEL 1 /* system part of Remote File I/O */ #include /* system logger */ #include #include #include "rfio.h" /* remote file I/O definitions */ #include "rfio_rfilefdt.h" #include "rfcntl.h" /* remote file control mapping macros */ #if !defined(_WIN32) #include /* for inet_ntoa() */ #include #include #endif #include #include #include #include static int na_key = -1; extern RFILE *rfilefdt[MAXRFD]; /* File descriptors tables */ static void rfio_setup64_ext(iop,uid,gid,passwd) RFILE *iop; int uid; int gid; int passwd; { extern char * getenv() ; /* External declaration */ char *cp ; /* Character pointer */ int v ; char rfio_buf[BUFSIZ] ; if ( cp= getenv("RFIO_READOPT") ) { v = atoi(cp) ; rfiosetopt(RFIO_READOPT, &v , 4) ; } /* * We don't allow READAHEAD without buffering * until the Ultra bug ( or mine ) is fixed. if ( rfioreadopt(RFIO_READOPT) == 2 ) { v = 3 ; rfiosetopt( RFIO_READOPT, &v ,4) ; } */ iop->magic = RFIO_MAGIC; iop->mode64 = 1; iop->s = -1; if (uid || gid) iop->mapping=0; else iop->mapping=1; iop->passwd=passwd; /* used only if mapping == 0 */ iop->uid = (uid==0 ? geteuid(): uid); iop->gid = (gid==0 ? getegid(): gid); INIT_TRACE("RFIO_TRACE"); TRACE ( 1,"rfio","rfio_setup64_ext(%d,%d,%d)",iop,uid,gid); TRACE ( 2,"rfio","rfio_setup64_ext: owner s uid is %d",iop->uid); TRACE ( 2,"rfio","rfio_setup64_ext: owner s gid is %d",iop->gid); END_TRACE(); (void) umask(iop->umask=umask(0)); iop->bufsize = 0; iop->ftype = FFTYPE_C; iop->binary = 0; /* no translation needed */ iop->eof = 0; iop->unit = 0; iop->access = 0; iop->format = 0; iop->recl = 0; iop->blank = 0; iop->opnopt = 0; iop->offset = 0 ; iop->socset = 0 ; iop->_iobuf.base = NULL; iop->_iobuf.ptr = NULL; iop->_iobuf.count = 0; iop->_iobuf.hsize = 0; iop->_iobuf.dsize = 0; iop->lseekhow= -1 ; iop->ahead= rfioreadopt(RFIO_READOPT) & RFIO_READAHEAD ; iop->eof= 0 ; iop->readissued = 0; iop->preseek = 0; iop->nbrecord = 0; iop->version3 = 0; iop->offset64 = 0; iop->lseekoff64 = 0; strcpy(iop->host,"????????"); } int DLL_DECL rfio_open64(filepath, flags, mode) char *filepath ; int flags,mode ; { int n; int old; old = rfioreadopt(RFIO_READOPT); if ((old & RFIO_STREAM) == RFIO_STREAM) n = rfio_open64_v3(filepath,flags,mode); else n = rfio_open64_v2(filepath,flags,mode); return(n); } int rfio_open64_v2(filepath, flags, mode) char * filepath ; int flags,mode ; { char rh[1] ; rh[0]='\0' ; return(rfio_open64_ext(filepath, flags, mode,(uid_t)0,(gid_t)0,0,rh)); } /* * Remote file open. */ int rfio_open64_ext(filepath, flags, mode,uid,gid,passwd,reqhost) char * filepath ; int flags,mode ; uid_t uid; gid_t gid; int passwd ; char * reqhost; /* In case of a Non-mapped I/O with uid & gid sepcified, which host will be contacted for key check ? */ { int status ; /* Return code */ int rcode ; /* Remote errno */ int len ; /* Request length */ int replen; /* Reply length */ char * host ; char * filename; char * account; char * p ; /* Pointer to rfio buffer */ RFILE * rfp ; /* Remote file pointer */ int rfp_index; WORD req ; /* Request code */ struct passwd *pw; int rt ; /* daemon in site(0) or not (1) */ int bufsize ; /* socket buffer size */ extern void rfio_setup_ext(); extern char * getacct() ; extern char * getconfent() ; extern char * getifnam() ; int old,n,parserc; int n_index; off64_t offset; /* Open offset length */ char rfio_buf[BUFSIZ]; int save_errno, save_serrno; const char *tname, *tip; /* Avoiding Valgrind error messages about uninitialized data */ memset(rfio_buf, 0, BUFSIZ); INIT_TRACE("RFIO_TRACE"); TRACE(1,"rfio","rfio_open64_ext(%s, 0%o, 0%o, %d, %d, %d, %s)", filepath,flags,mode,uid,gid,passwd,reqhost ) ; /* the rtcopy program calls directly rfio_open_ext, so we (again) do this test here, ugly */ old = rfioreadopt(RFIO_READOPT); /* V3 stream protocol for sequential transfers */ if (old == RFIO_STREAM) { n = rfio_open64_ext_v3(filepath,flags,mode,uid,gid,passwd,reqhost); return(n); } /* Version 2 behaviour starts here */ #if defined (CLIENTLOG) /* Client logging */ rfio_logst(); #endif /* CLIENTLOG */ /* * The file is local. */ if ( ! (parserc = rfio_parse(filepath,&host,&filename)) ) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file */ TRACE(1,"rfio","rfio_open64_ext: %s is an HSM path", filename); END_TRACE(); rfio_errno = 0; return(rfio_HsmIf_open(filename,flags,mode,1)); } TRACE(1,"rfio","rfio_open64_ext: %s is a local path", filename); END_TRACE(); status = open64(filename, flags, mode) ; if ( status < 0 ) serrno = 0; rfio_errno = 0; END_TRACE() ; #if defined (CLIENTLOG) /* Client logging */ rfio_logop(status,filename,host,flags); #endif /* CLIENTLOG */ return status ; } if (parserc < 0) { END_TRACE(); return(-1); } /* * Allocate and initialize a remote file descriptor. */ if ((rfp = (RFILE *)malloc(sizeof(RFILE))) == NULL) { TRACE(2, "rfio", "rfio_open64_ext: malloc(): ERROR occured (errno=%d)", errno); END_TRACE(); return(-1); } rfio_setup64_ext(rfp,(int)uid,(int)gid,passwd) ; TRACE(2, "rfio", "rfio_open64_ext: RFIO descriptor allocated at 0x%X", rfp); /* * Connecting server. */ rfp->s = rfio_connect(host,&rt); if (rfp->s < 0) { TRACE(2, "rfio", "rfio_open64_ext: freeing RFIO descriptor at 0X%X", rfp); (void) free(rfp); END_TRACE(); return(-1); } tname = Cgetnetaddress(rfp->s, NULL, 0, &na_key, &tip, NULL, 0, 0); if (tname == NULL || strlen(tip)>=RESHOSTNAMELEN) { TRACE(2, "rfio", "open64: Cgetnetaddress: %s\n",(tname == NULL) ? sstrerror(serrno) : "Names too long"); close(rfp->s); (void) free(rfp); END_TRACE(); return(-1); } if (strlen(tname)host, tname); else strcpy(rfp->host, tip); if ( !rt && !rfp->mapping ) { rfp->uid=geteuid() ; rfp->gid=getegid() ; TRACE(3,"rfio", "rfio_open64_ext: re-setting (uid,gid) to %d,%d",rfp->uid,rfp->gid) ; rfp->mapping = 1 ; } /* * Remote file table is not large enough. */ if ((rfp_index = rfio_rfilefdt_allocentry(rfp->s)) == -1) { TRACE(2, "rfio", "rfio_open64_ext: freeing RFIO descriptor at 0X%X", rfp); (void) close(rfp->s); (void) free(rfp); END_TRACE(); errno= EMFILE ; return -1 ; } rfilefdt[rfp_index]=rfp; /* Set version3 to false since we are running version 2 here */ rfilefdt[rfp_index]->version3 = 0; bufsize= DEFIOBUFSIZE ; if ((p = getenv("RFIO_IOBUFSIZE")) != NULL || (p = getconfent("RFIO", "IOBUFSIZE", 0)) != NULL) { if ((bufsize = atoi(p)) <= 0) { bufsize = DEFIOBUFSIZE; } } else /* reset error code */ serrno=0; TRACE(2, "rfio", "rfio_open64_ext: setsockopt(SOL_SOCKET, SO_KEEPALIVE)"); rcode = 1 ; if (setsockopt(rfp->s, SOL_SOCKET, SO_KEEPALIVE,(char *)&rcode, sizeof (int) ) == -1) { TRACE(2, "rfio" ,"rfio_open64_ext: setsockopt(SO_KEEPALIVE) failed"); syslog(LOG_ALERT, "rfio: open64: setsockopt(SO_KEEPALIVE): %s", strerror(errno)); } if ( (p = getenv("RFIO_TCP_NODELAY")) != NULL ) { rcode = 1; TRACE(2,"rfio","rfio_open: setsockopt(IPPROTO_TCP,TCP_NODELAY)"); if ( setsockopt(rfp->s,IPPROTO_TCP,TCP_NODELAY,(char *)&rcode,sizeof(rcode)) == -1 ) { TRACE(2,"rfio","rfio_open: setsockopt(IPPROTO_TCP,TCP_NODELAY) failed"); } } /* * Allocate, if necessary, an I/O buffer. */ rfp->_iobuf.hsize= 3*LONGSIZE + WORDSIZE; if ( rfioreadopt(RFIO_READOPT) & RFIO_READBUF ) { rfp->_iobuf.dsize = bufsize - rfp->_iobuf.hsize; if ((rfp->_iobuf.base = malloc(bufsize)) == NULL) { rfio_cleanup(rfp->s); END_TRACE(); return -1 ; } TRACE(2, "rfio", "rfio_open64_ext: I/O buffer allocated at 0x%X", rfp->_iobuf.base) ; rfp->_iobuf.count = 0; rfp->_iobuf.ptr = iodata(rfp) ; } if ( (pw = Cgetpwuid(geteuid()) ) == NULL ) { TRACE(2, "rfio" ,"rfio_open64_ext: Cgetpwuid() error %s",strerror(errno)); rfio_cleanup(rfp->s); END_TRACE(); return -1 ; } /* * Building and sending request. */ /* if ((account = getacct()) == NULL) */ account = ""; TRACE(2,"rfio","rfio_open64_ext: uid %d gid %d umask %o ftype %d, mode 0%o, flags 0%o", rfp->uid,rfp->gid,rfp->umask,rfp->ftype,mode,flags) ; TRACE(2,"rfio","rfio_open64_ext: account: %s",account) ; TRACE(2,"rfio","rfio_open64_ext: filename: %s",filename) ; if (reqhost != NULL && strlen(reqhost) ) TRACE(2,"rfio","rfio_open64_ext: requestor's host: %s",reqhost) ; p= rfio_buf ; len= 5*WORDSIZE + 3*LONGSIZE + strlen(account) + strlen(filename) +strlen(pw->pw_name) + strlen(reqhost) + 4 ; marshall_WORD(p,B_RFIO_MAGIC) ; marshall_WORD(p,RQST_OPEN64) ; marshall_LONG(p,len) ; p= rfio_buf + RQSTSIZE ; marshall_WORD(p,rfp->uid) ; marshall_WORD(p,rfp->gid) ; marshall_WORD(p,rfp->umask) ; marshall_WORD(p,FFTYPE_C) ; marshall_LONG(p,htonopnflg(flags)) ; marshall_LONG(p,mode) ; marshall_STRING(p,account) ; marshall_STRING(p,filename) ; marshall_STRING(p,pw->pw_name) ; marshall_STRING(p,reqhost) ; marshall_LONG(p,rfp->passwd); marshall_WORD(p,rfp->mapping); errno = 0; TRACE(2,"rfio","rfio_open64_ext: sending %d bytes",RQSTSIZE+len) ; if (netwrite_timeout(rfp->s,rfio_buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { TRACE(2,"rfio","rfio_open64_ext: write(): ERROR occured (errno=%d)", errno) ; syslog(LOG_ALERT, "rfio: open64: %s (error %d with %s) [uid=%d,gid=%d,pid=%d] in netwrite(%d,0X%X,%d)", strerror(errno), errno, rfp->host, rfp->uid, rfp->gid, getpid(), rfp->s, rfio_buf, RQSTSIZE+len); rfio_cleanup(rfp->s) ; END_TRACE() ; return -1 ; } /* * Getting status and current offset. */ replen = rfp->_iobuf.hsize + HYPERSIZE; TRACE(1, "rfio", "rfio_open64_ext: reading %d bytes",rfp->_iobuf.hsize) ; if (netread_timeout(rfp->s, rfio_buf, replen, RFIO_CTRL_TIMEOUT) != replen ) { save_errno = errno; save_serrno = serrno; #if !defined(_WIN32) if ( serrno == SECONNDROP || errno == ECONNRESET ) { #else if ( serrno == SECONNDROP || serrno == SETIMEDOUT ) { #endif TRACE(2, "rfio", "rfio_open64_ext: read(): The connection with the server has been broken"); } else { TRACE(2, "rfio", "rfio_open64_ext: read(): ERROR %d occured (errno=%d, serrno=%d)", replen, errno, serrno); syslog(LOG_ALERT, "rfio: open64: %s (error %d with %s) [uid=%d,gid=%d,pid=%d] in netread(%d,0X%X,%d)", strerror(errno), errno, rfp->host, rfp->uid, rfp->gid, getpid(), rfp->s, rfio_buf, replen); } rfio_cleanup(rfp->s); errno = save_errno; serrno = save_serrno; return(-1); } p= rfio_buf ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; p += LONGSIZE; unmarshall_HYPER(p, offset) ; TRACE(1,"rfio","rfio_open64_ext: return status(%d), rcode(%d), fd: %d",status,rcode,rfp->s) ; if ( status < 0 ) { if ( rcode >= SEBASEOFF) serrno = rcode ; else rfio_errno= rcode ; /* Operation failed but no error message was sent */ if ( rcode == 0 ) serrno = SENORCODE ; rfio_cleanup(rfp->s) ; return -1 ; } else { rfp->offset64= offset ; } #if defined (CLIENTLOG) /* Client logging */ rfio_logop(rfp->s,filename,host,flags); #endif /* * The file is open, update rfp->fp */ #if defined(hpux) rfp->fp.__fileL = rfp->s; #else #if defined(linux) rfp->fp._fileno = rfp->s; #else #if defined(__Lynx__) rfp->fp._fd = rfp->s; #else rfp->fp._file = rfp->s; #endif /* __Lynx__ */ #endif /* linux */ #endif /* hpux */ END_TRACE() ; return (rfp->s) ; } void rfio_setup64(iop) RFILE *iop; { (void)rfio_setup64_ext(iop,0,0,0); } lcgdm-1.10.0/rfio/fclose.c0000644000175000017500000000451211533400617014577 0ustar ellertellert/* * $Id: fclose.c 4148 2011-03-02 08:36:31Z baud $ */ /* * Copyright (C) 1990-2011 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: fclose.c,v $ $Revision: 4148 $ $Date: 2011-03-02 09:36:31 +0100 (Wed, 02 Mar 2011) $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy"; #endif /* not lint */ /* fclose.c Remote File I/O - close a binary file */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "Castor_limits.h" #include "rfio.h" #include "rfio_rfilefdt.h" #include int DLL_DECL rfio_fclose(fp) /* Remote file close */ RFILE *fp; /* Remote file pointer */ { int HsmType; int save_errno; int status; int status1; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_fclose(%x)", fp); if ( fp == NULL ) { errno = EBADF; END_TRACE(); return -1 ; } /* * Check if file is Hsm. For CASTOR HSM files, the file is * closed using normal RFIO (local or remote) close(). */ /* * The file is local : this is the only way to detect it ! */ if (rfio_rfilefdt_findptr(fp,FINDRFILE_WITH_SCAN) == -1) { char r_token[CA_MAXDPMTOKENLEN+1]; char upath[CA_MAXHOSTNAMELEN+CA_MAXPATHLEN+2]; int fd = fileno((FILE *)fp); HsmType = rfio_HsmIf_GetHsmType(fd,NULL); if ( HsmType > 0 ) { if ( HsmType != RFIO_HSM_CNS ) { status = rfio_HsmIf_close(fd); END_TRACE() ; return(status); } status1 = rfio_HsmIf_getipath(fd,upath,r_token); } status= fclose((FILE *)fp) ; if ( status < 0 ) serrno = 0; save_errno = errno; if ( HsmType == RFIO_HSM_CNS ) { if ( status1 == 1 ) { status1 = rfio_HsmIf_reqtoput(upath,r_token); if ( status1 == 0 ) errno = save_errno; } } else { status1 = 0; } END_TRACE() ; rfio_errno = 0; return (status ? status : status1) ; } /* * The file is remote */ if ( fp->magic != RFIO_MAGIC ) { int fps = fp->s; free((char *)fp); (void) close(fps); END_TRACE() ; return -1 ; } status= rfio_close(fp->s) ; END_TRACE() ; return status ; } lcgdm-1.10.0/rfio/rfio_popen.man0000644000175000017500000000353511066421615016023 0ustar ellertellert.\" .\" $Id: rfio_popen.man,v 1.2 2008/09/24 11:25:01 dhsmith Exp $ .\" .\" @(#)$RCSfile: rfio_popen.man,v $ $Revision: 1.2 $ $Date: 2008/09/24 11:25:01 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2008 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_POPEN 3 "$Date: 2008/09/24 11:25:01 $" CASTOR "Rfio Library Functions" .SH NAME rfio_popen, rfio_pclose \- start a process and open a pipe to it .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "FILE *rfio_popen (const char *" command ", const char *" type ");" .sp .BI "int rfio_pclose (FILE *" fs ");" .SH DESCRIPTION .B rfio_popen starts a process and opens a pipe to it. .LP .I command is a pointer to a string specifying the shell command to be executed. .P .I type is a mode indicator for the pipe. One of the characters "r" or "w". .LP .B rfio_pclose waits for the forked process to terminate and returns the exit status of the command. .SH EXAMPLE .nf .ft CW int c; FILE *rf; rf = rfio_popen (command, "r"); if (rf == NULL) { rfio_perror ("rfio_popen"); exit (1); } while ((c = rfio_pread (buf, 1, sizeof(buf), rf)) > 0) { ... } c = rfio_pclose (rf); .ft .fi .SH RETURN VALUE This routine returns NULL if the operation failed or a non-NULL pointer to a FILE structure if the operation was successful. If it fails, \fBserrno\fP variable is set appropriately. .SH ERRORS .TP 1.3i .B ENOMEM Not enough memory. .TP .B EINVAL The mode provided is invalid. .TP .B ECONNRESET Connection reset by peer .TP .B ETIMEDOUT Connection timed out .TP .B ECONNREFUSED Connection refused .TP .B EHOSTUNREACH No route to host .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SEUMSG2LONG Command string too long. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR rfio_pread(3) , .BR rfio_pwrite(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/ftello64.c0000644000175000017500000000332311533400617014762 0ustar ellertellert/* * $Id: ftello64.c 4148 2011-03-02 08:36:31Z baud $ */ /* * Copyright (C) 1990-2011 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: ftello64.c,v $ $Revision: 4148 $ $Date: 2011-03-02 09:36:31 +0100 (Wed, 02 Mar 2011) $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy, P. Gaillardon"; #endif /* not lint */ /* ftello64.c Remote File I/O - get current file position. */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rfilefdt.h" #include "u64subr.h" #include /* * Remote file ftello */ off64_t rfio_ftello64(fp) RFILE *fp; { off64_t offsetout; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_ftello64(%x)", fp); /* * Checking fp validity */ if (fp == NULL) { errno = EBADF; TRACE(2,"rfio","rfio_ftello64() : FILE ptr is NULL "); END_TRACE(); return -1; } /* * The file is local : this is the only way to detect it ! */ if (rfio_rfilefdt_findptr(fp,FINDRFILE_WITH_SCAN) == -1) { TRACE(2,"rfio","rfio_ftello64() : using local ftello64() "); offsetout = ftello64((FILE *)fp); if ( offsetout < 0 ) serrno = 0; rfio_errno = 0; END_TRACE(); return offsetout; } TRACE(2,"rfio","rfio_ftello64() : after remoteio") ; /* * Checking magic number */ if (fp->magic != RFIO_MAGIC) { int fps = fp->s; serrno = SEBADVERSION; TRACE(2,"rfio","rfio_ftello64() : Bad magic number"); free((char *)fp); (void) close(fps); END_TRACE(); return -1; } /* Just use rfio_lseek64 */ offsetout = rfio_lseek64(fp->s, (off64_t)0, SEEK_CUR); END_TRACE(); return offsetout; } lcgdm-1.10.0/rfio/pclose.c0000644000175000017500000000475111533400617014616 0ustar ellertellert/* * $Id: pclose.c 4148 2011-03-02 08:36:31Z baud $ */ /* * Copyright (C) 1993-2011 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: pclose.c,v $ $Revision: 4148 $ $Date: 2011-03-02 09:36:31 +0100 (Wed, 02 Mar 2011) $ CERN/IT/PDP/DM Felix Hassine"; #endif /* not lint */ /* pclose.c Remote command I/O - close a popened command */ #if defined(_WIN32) #define WEXITSTATUS(status) ((status>>8)&0xFF) #else #include #endif #include #include #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rfilefdt.h" #include /* * remote pclose */ int DLL_DECL rfio_pclose(fs) RFILE *fs ; { char * p ; int status, fss ; char buf[256]; /* General input/output buffer */ INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_pclose(%x)", fs); /* * The file is local */ if (rfio_rfilefdt_findptr(fs,FINDRFILE_WITH_SCAN) == -1 ) { TRACE(2, "rfio", "rfio_pclose: using local pclose") ; #if defined(_WIN32) status = _pclose(fs->fp_save); #else status= pclose(fs->fp_save); #endif if ( status < 0 ) serrno = 0; free((char *)fs); END_TRACE() ; rfio_errno = 0; return status ; } /* * Checking magic number */ if ( fs->magic != RFIO_MAGIC ) { serrno = SEBADVERSION ; free((char *)fs); END_TRACE(); return -1; } /* * Sending request. */ p= buf ; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_PCLOSE); TRACE(2, "rfio", "rfio_pclose: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(fs->s, buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { fss = fs->s; TRACE(2, "rfio", "rfio_pclose: write(): ERROR occured (errno=%d)", errno); (void) free((char *)fs) ; (void)close(fss) ; END_TRACE() ; return -1 ; } /* * Getting data from the network. */ p = buf ; if ( netread_timeout( fs->s , buf, 2*LONGSIZE, RFIO_CTRL_TIMEOUT) != 2*LONGSIZE) { fss = fs->s; TRACE(2,"rfio", "pclose: write(): %s", strerror(errno)); (void) free((char *)fs) ; (void)close(fss) ; END_TRACE() ; return -1 ; } unmarshall_LONG(p, status) ; unmarshall_LONG(p, rfio_errno) ; TRACE(3,"rfio", "rfio_pclose: status is %d, rfio_errno is %d",status,rfio_errno); /* * freeing RFILE pointer */ fss = fs->s; (void) free((char *)fs) ; (void) close(fss) ; return status ; } lcgdm-1.10.0/rfio/rfio_HsmIf.c0000644000175000017500000006430111336205452015354 0ustar ellertellert/* * Copyright (C) 2000-2010 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rfio_HsmIf.c,v $ $Revision: 3172 $ $Date: 2010-02-15 09:51:54 +0100 (Mon, 15 Feb 2010) $ CERN/IT/PDP/DM Olof Barring"; #endif /* not lint */ /* rfio_HsmIf.c Remote File I/O - generic HSM client interface */ #include "Cmutex.h" #include #if !defined(_WIN32) #include #endif /* _WIN32 */ #include #include #include #include #if defined(_WIN32) #define R_OK 4 #define W_OK 2 #define X_OK 1 #define F_OK 0 #endif /* _WIN32 */ #include #include #define RFIO_KERNEL 1 #include "Cglobals.h" #include "serrno.h" struct stage_hsm { char *sfn; char *r_token; }; typedef struct stage_hsm stage_hsm_t; #include "dpm_api.h" #include "dpns_api.h" #include "rfio.h" #include "osdep.h" #if defined(CNS_ROOT) typedef struct CnsFiles { int s; int mode; int written_to; stage_hsm_t *hsmfile; } CnsFiles_t; static CnsFiles_t *CnsFilesfdt[MAXRFD]; static CnsFiles_t dummyCnsFile; #endif /* CNS_ROOT */ static int cwdserver_key = -1; static int cwdtype_key = -1; static int DIRcontext_key = -1; typedef struct rfio_HsmIf_DIRcontext { DIR *dirp; char dirpath[CA_MAXPATHLEN+1]; char *current_entry; #if defined(CNS_ROOT) struct Cns_filestat Cns_st; #endif /* CNS_ROOT */ struct dirent *de; int HsmType; int GetStat; } rfio_HsmIf_DIRcontext_t; static rfio_HsmIf_DIRcontext_t *HsmDirs[MAXRFD]; #if defined(CNS_ROOT) #define FINDCNSFILES_WITH_SCAN 1 #define FINDCNSFILES_WITHOUT_SCAN 0 static int rfio_CnsFilesfdt_allocentry _PROTO((int)); static int rfio_CnsFilesfdt_findentry _PROTO((int,int)); static int rfio_CnsFilesfdt_freeentry _PROTO((int)); /* * Internal file info. table. Note that those routines do not * guarantee atomicity. Concurrent writer threads to a single file * may have problems (they would anyway!). */ static int AddCnsFileDescriptor(int fd, int mode, stage_hsm_t *hsmfile) { int s_index; CnsFiles_t *thisCnsFile; if ((s_index = rfio_CnsFilesfdt_allocentry(fd)) < 0) { serrno = SEINTERNAL; return(-1); } if ((thisCnsFile = malloc(sizeof(CnsFiles_t))) == NULL) { rfio_CnsFilesfdt_freeentry(s_index); serrno = SEINTERNAL; return(-1); } CnsFilesfdt[s_index] = thisCnsFile; CnsFilesfdt[s_index]->s = fd; CnsFilesfdt[s_index]->hsmfile = hsmfile; CnsFilesfdt[s_index]->mode = mode; CnsFilesfdt[s_index]->written_to = 0; return(0); } static int SetCnsWrittenTo(int fd) { int s_index; if ((s_index = rfio_CnsFilesfdt_findentry(fd,FINDCNSFILES_WITHOUT_SCAN)) < 0) { serrno = SEINTERNAL; return(-1); } if ( CnsFilesfdt[s_index]->hsmfile == NULL ) { serrno = ENOENT; return(-1); } CnsFilesfdt[s_index]->written_to = 1; return(0); } static int GetCnsFileDescriptor(int fd, int *mode, stage_hsm_t **hsmfile, int *written_to) { int s_index; if ((s_index = rfio_CnsFilesfdt_findentry(fd,FINDCNSFILES_WITHOUT_SCAN)) < 0) { serrno = SEINTERNAL; return(-1); } if ( CnsFilesfdt[s_index]->hsmfile == NULL ) { serrno = ENOENT; return(-1); } if ( hsmfile != NULL ) *hsmfile = CnsFilesfdt[s_index]->hsmfile; if ( mode != NULL ) *mode = CnsFilesfdt[s_index]->mode; if ( written_to ) *written_to = CnsFilesfdt[s_index]->written_to; return(0); } static int DelCnsFileDescriptor(int fd) { int s_index; if ((s_index = rfio_CnsFilesfdt_findentry(fd,FINDCNSFILES_WITHOUT_SCAN)) < 0) { serrno = SEINTERNAL; return(-1); } rfio_CnsFilesfdt_freeentry(s_index); return(0); } static int CnsCleanup(stage_hsm_t **hsmfile) { if ( hsmfile == NULL || *hsmfile == NULL) return(0); if ( (*hsmfile)->sfn != NULL ) free((*hsmfile)->sfn); if ( (*hsmfile)->r_token != NULL ) free((*hsmfile)->r_token); free(*hsmfile); return(0); } void rfio_stglog(int type, char *msg) { TRACE(3,"rfio","rfio_stglog: %s",msg); return; } #endif /* CNS_ROOT */ int rfio_HsmIf_AddCnsFileDescriptor(int fd, int mode, stage_hsm_t *hsmfile) { return(AddCnsFileDescriptor(fd, mode, hsmfile)); } int DLL_DECL rfio_HsmIf_SetCnsWrittenTo(int fd) { return(SetCnsWrittenTo(fd)); } int rfio_HsmIf_IsCnsFile(const char *path) { int rc = 0; #if defined(CNS_ROOT) char *q = (char *)path + strlen(CNS_ROOT); if ( strncmp(path,CNS_ROOT,strlen(CNS_ROOT)) == 0 && ( *q == '/' || *q == '\0' ) ) rc = 1; else if ( *path != '/' && rfio_HsmIf_GetCwdType() == RFIO_HSM_CNS ) rc = 1; #endif /* CNS_ROOT */ return(rc); } static int rfio_HsmIf_SwapHsmDirEntry(rfio_HsmIf_DIRcontext_t *OldHsmDir, rfio_HsmIf_DIRcontext_t *NewHsmDir) { int i; if ( OldHsmDir == NULL && NewHsmDir == NULL ) return(-1); if ( Cmutex_lock((void *) HsmDirs, -1) != 0 ) return(-1); for (i = 0; i < MAXRFD; i++) if ( HsmDirs[i] == OldHsmDir ) break; if ( i < MAXRFD && HsmDirs[i] != NewHsmDir ) HsmDirs[i] = NewHsmDir; if ( Cmutex_unlock((void *)HsmDirs) != 0 ) return(-1); if ( i >= MAXRFD ) return(-1); return(i); } static int rfio_HsmIf_AddDirEntry(rfio_HsmIf_DIRcontext_t *HsmDir) { int rc; rc = rfio_HsmIf_SwapHsmDirEntry(NULL,HsmDir); TRACE(3,"rfio","rfio_HsmIf_AddDirEntry(0x%x) -> RC=%d\n",HsmDir,rc); return(rc); } static int rfio_HsmIf_DelDirEntry(rfio_HsmIf_DIRcontext_t *HsmDir) { int rc; rc = rfio_HsmIf_SwapHsmDirEntry(HsmDir,NULL); TRACE(3,"rfio","rfio_HsmIf_DelDirEntry(0x%x) -> RC=%d\n",HsmDir,rc); return(rc); } static int rfio_HsmIf_FindDirEntry(rfio_HsmIf_DIRcontext_t *HsmDir) { int rc; rc = rfio_HsmIf_SwapHsmDirEntry(HsmDir,HsmDir); TRACE(3,"rfio","rfio_HsmIf_FindDirEntry(0x%x) -> RC=%d\n",HsmDir,rc); return(rc); } int DLL_DECL rfio_HsmIf_IsHsmDirEntry(DIR *HsmDir) { return(rfio_HsmIf_FindDirEntry((rfio_HsmIf_DIRcontext_t *)HsmDir)); } int DLL_DECL rfio_HsmIf_IsHsmFile(const char *path) { int rc = 0; if ( (rc = rfio_HsmIf_IsCnsFile(path)) == 1 ) return(rc); return(rc); } char DLL_DECL *rfio_HsmIf_GetCwdServer() { char *cwd_server = NULL; Cglobals_get(&cwdserver_key, (void **)&cwd_server, CA_MAXHOSTNAMELEN+1); return(cwd_server); } int DLL_DECL rfio_HsmIf_GetCwdType() { int *cwd_type = NULL; Cglobals_get(&cwdtype_key, (void **)&cwd_type, CA_MAXHOSTNAMELEN+1); return(*cwd_type); } int DLL_DECL rfio_HsmIf_SetCwdServer(const char *path) { char *cwd_server = NULL; Cglobals_get(&cwdserver_key, (void **)&cwd_server, CA_MAXHOSTNAMELEN+1); strncpy(cwd_server, path, CA_MAXHOSTNAMELEN); cwd_server[CA_MAXHOSTNAMELEN] = '\0'; return(0); } int DLL_DECL rfio_HsmIf_SetCwdType(int n) { int *cwd_type = NULL; Cglobals_get(&cwdtype_key, (void **)&cwd_type, sizeof(int)); *cwd_type = n; return(0); } int DLL_DECL rfio_HsmIf_GetHsmType(int fd, int *WrittenTo) { int rc = -1; #if defined(CNS_ROOT) { int s_index; if ((s_index = rfio_CnsFilesfdt_findentry(fd,FINDCNSFILES_WITHOUT_SCAN)) >= 0) { if ( CnsFilesfdt[s_index]->hsmfile != NULL ) { rc = RFIO_HSM_CNS; if ( WrittenTo != NULL ) *WrittenTo = CnsFilesfdt[s_index]->written_to; } } } #endif /* CNS_ROOT */ return(rc); } int DLL_DECL rfio_HsmIf_access(const char *path, int amode) { int rc = -1; #if defined(CNS_ROOT) if ( rfio_HsmIf_IsCnsFile(path) ) { rc = Cns_access(path,amode); } #endif /* CNS_ROOT */ return(rc); } int DLL_DECL rfio_HsmIf_chdir(const char *path) { int rc = -1; #if defined(CNS_ROOT) if ( rfio_HsmIf_IsCnsFile(path) ) { if ( (rc = Cns_chdir(path)) == 0) rfio_HsmIf_SetCwdType(RFIO_HSM_CNS); } #endif /* CNS_ROOT */ return(rc); } int DLL_DECL rfio_HsmIf_chmod(const char *path, mode_t mode) { int rc = -1; #if defined(CNS_ROOT) if ( rfio_HsmIf_IsCnsFile(path) ) { rc = Cns_chmod(path,mode); } #endif /* CNS_ROOT */ return(rc); } int DLL_DECL rfio_HsmIf_chown(const char *path, uid_t new_uid, gid_t new_gid) { int rc = -1; #if defined(CNS_ROOT) if ( rfio_HsmIf_IsCnsFile(path) ) { rc = Cns_chown(path,new_uid,new_gid); } #endif /* CNS_ROOT */ return(rc); } int DLL_DECL rfio_HsmIf_close(int fd) { int rc = -1; #if defined(CNS_ROOT) char r_token[CA_MAXDPMTOKENLEN+1]; char upath[CA_MAXHOSTNAMELEN+CA_MAXPATHLEN+2]; rc = rfio_HsmIf_getipath(fd,upath,r_token); if (rc == 1) rc = rfio_HsmIf_reqtoput(upath,r_token); #endif /* CNS_ROOT */ return(rc); } int DLL_DECL rfio_HsmIf_closedir(DIR *dirp) { rfio_HsmIf_DIRcontext_t *tmp = NULL; rfio_HsmIf_DIRcontext_t **myDIRcontext = NULL; int rc = -1; tmp = (rfio_HsmIf_DIRcontext_t *)dirp; #if defined(CNS_ROOT) if ( tmp->HsmType == RFIO_HSM_CNS ) { rc = Cns_closedir((Cns_DIR *)(tmp->dirp)); rfio_HsmIf_DelDirEntry(tmp); Cglobals_get(&DIRcontext_key,(void **)&myDIRcontext, sizeof(rfio_HsmIf_DIRcontext_t *)); if ( (myDIRcontext != NULL) && (*myDIRcontext == tmp) ) *myDIRcontext = NULL; if (tmp->de != NULL) free(tmp->de); free(tmp); } #endif /* CNS_ROOT */ return(rc); } int DLL_DECL rfio_HsmIf_creat(const char *path, mode_t mode) { int rc = -1; #if defined(CNS_ROOT) if ( rfio_HsmIf_IsCnsFile(path) ) { rc = Cns_creat(path,mode); } #endif /* CNS_ROOT */ return(rc); } char DLL_DECL *rfio_HsmIf_getcwd(char *buf, int size) { char *cwd = NULL; #if defined(CNS_ROOT) if ( rfio_HsmIf_GetCwdType() == RFIO_HSM_CNS ) cwd = Cns_getcwd(buf, size); #endif /* CNS_ROOT */ return(cwd); } /* Output is: -1 if error */ /* : 0 if rfio_HsmIf_reqtoput(name) is NOT to be done */ /* : 1 if rfio_HsmIf_reqtoput(name) IS to be done */ /* Note: name should point to a buffer of size CA_MAXHOSTNAMELEN+MAXPATH+2 */ int DLL_DECL rfio_HsmIf_getipath(int fd, char *name, char *r_token) { int rc = -1; #if defined(CNS_ROOT) int flags, written_to; stage_hsm_t *hsmfile = NULL; /* * No specific close needed */ rc = GetCnsFileDescriptor(fd,&flags,&hsmfile,&written_to); (void)DelCnsFileDescriptor(fd); if ( rc == -1 ) return(-1); if ( (flags & (O_RDONLY|O_RDWR|O_WRONLY)) != O_RDONLY && written_to != 0 ) rc = 1; else rc = 0; /* Before cleanup of hsmfile we copy content of name */ if (name != NULL) strcpy(name, hsmfile->sfn); if (r_token != NULL) strcpy(r_token, hsmfile->r_token); (void)CnsCleanup(&hsmfile); #endif /* CNS_ROOT */ return(rc); } int DLL_DECL rfio_HsmIf_mkdir(const char *path, mode_t mode) { int rc = -1; #if defined(CNS_ROOT) if ( rfio_HsmIf_IsCnsFile(path) ) { rc = Cns_mkdir(path,mode); } #endif /* CNS_ROOT */ return(rc); } int DLL_DECL rfio_HsmIf_open(const char *path, int flags, mode_t mode, int mode64) { int rc = -1; int save_serrno; #if defined(CNS_ROOT) struct Cns_filestat st; stage_hsm_t *hsmfile = NULL; #endif /* CNS_ROOT */ #if defined(CNS_ROOT) if ( rfio_HsmIf_IsCnsFile(path) ) { /* * Check if an existing file is going to be updated */ memset(&st,'\0',sizeof(st)); rc = Cns_stat(path,&st); /* * Make sure that filesize is 0 if file doesn't exist (a * overdoing) or that we will create (stage_out) if O_TRUNC. */ if ( rc == -1 || ((flags & O_TRUNC) != 0)) st.filesize = 0; /* * Do the work */ hsmfile = (stage_hsm_t *)calloc(1,sizeof(stage_hsm_t)); { char *p; char *pfn; char *turl; hsmfile->sfn = strdup(path); hsmfile->r_token = malloc(CA_MAXDPMTOKENLEN+1); TRACE(3,"rfio","Calling dpm_getturl with: %s %x\n", path, flags); if ((turl = dpm_getturl(path, flags, (u_signed64) 0, hsmfile->r_token)) == NULL) { (void)CnsCleanup(&hsmfile); return (-1); } pfn = turl + 7; p = strchr (pfn, '/'); *p = ':'; if (mode64) { rc = rfio_open64(pfn, flags, mode); } else { rc = rfio_open(pfn, flags, mode); } free(turl); if (rc == -1) { (void)CnsCleanup(&hsmfile); return (-1); } } if ( AddCnsFileDescriptor(rc,flags,hsmfile) == -1 ) { save_serrno = serrno; (void)CnsCleanup(&hsmfile); rfio_close(rc); serrno = save_serrno; return(-1); } if ( st.filesize == 0 ) SetCnsWrittenTo(rc); } #endif /* CNS_ROOT */ return(rc); } int DLL_DECL rfio_HsmIf_open_limbysz(const char *path, int flags, mode_t mode, u_signed64 maxsize, int mode64) { int rc = -1; int save_serrno; #if defined(CNS_ROOT) struct Cns_filestat st; stage_hsm_t *hsmfile = NULL; #endif /* CNS_ROOT */ #if defined(CNS_ROOT) if ( rfio_HsmIf_IsCnsFile(path) ) { /* * Check if an existing file is going to be updated */ memset(&st,'\0',sizeof(st)); rc = Cns_stat(path,&st); /* * Make sure that filesize is 0 if file doesn't exist (a * overdoing) or that we will create (stage_out) if O_TRUNC. */ if ( rc == -1 || ((flags & O_TRUNC) != 0)) st.filesize = 0; /* * Do the work */ hsmfile = (stage_hsm_t *)calloc(1,sizeof(stage_hsm_t)); { char *p; char *pfn; char *turl; hsmfile->sfn = strdup(path); hsmfile->r_token = malloc(CA_MAXDPMTOKENLEN+1); TRACE(3,"rfio","Calling dpm_getturl with: %s %x\n", path, flags); if ((turl = dpm_getturl(path, flags, maxsize, hsmfile->r_token)) == NULL) { (void)CnsCleanup(&hsmfile); return (-1); } pfn = turl + 7; p = strchr (pfn, '/'); *p = ':'; if (mode64) { rc = rfio_open64(pfn, flags, mode); } else { rc = rfio_open(pfn, flags, mode); } free(turl); if (rc == -1) { (void)CnsCleanup(&hsmfile); return (-1); } } if ( AddCnsFileDescriptor(rc,flags,hsmfile) == -1 ) { save_serrno = serrno; (void)CnsCleanup(&hsmfile); rfio_close(rc); serrno = save_serrno; return(-1); } if ( st.filesize == 0 ) SetCnsWrittenTo(rc); } #endif /* CNS_ROOT */ return(rc); } DIR DLL_DECL *rfio_HsmIf_opendir(const char *path) { rfio_HsmIf_DIRcontext_t *tmp = NULL; char *p; #if defined(CNS_ROOT) if ( rfio_HsmIf_IsCnsFile(path) ) { tmp=(rfio_HsmIf_DIRcontext_t *)malloc(sizeof(rfio_HsmIf_DIRcontext_t)); if ( tmp == NULL ) return(NULL); tmp->HsmType = RFIO_HSM_CNS; tmp->dirp = (DIR *)Cns_opendir(path); if ( tmp->dirp == NULL) { free(tmp); return(NULL); } tmp->de = (struct dirent *)malloc(sizeof(struct dirent) + CA_MAXPATHLEN); memset(&tmp->Cns_st,'\0',sizeof(struct Cns_filestat)); memset(tmp->de,'\0',sizeof(struct dirent) + CA_MAXPATHLEN); /* * Remember the directory path but remove trailing slashes. */ strcpy(tmp->dirpath,path); while ( *(p = &tmp->dirpath[strlen(tmp->dirpath)-1]) == '/' ) *p = '\0'; tmp->current_entry = NULL; /* * Cns does not allow to intermix Cns_readdir() and Cns_readdirx() * thus we always force the latter */ tmp->GetStat = 1; } #endif /* CNS_ROOT */ if ( tmp != NULL && rfio_HsmIf_AddDirEntry(tmp) == -1 ) { #if defined(CNS_ROOT) (void) Cns_closedir((Cns_DIR *)(tmp->dirp)); free(tmp->de); free(tmp); #endif /* CNS_ROOT */ return(NULL); } return((DIR *)tmp); } int DLL_DECL rfio_HsmIf_reqtoput(char *name, char *r_token) { int rc = -1; int save_serrno; #if defined(CNS_ROOT) int nbreplies; struct dpm_filestatus *filestatuses; rc = dpm_putdone(r_token, 1, &name, &nbreplies, &filestatuses); if (rc == 0) { if (filestatuses->surl) free(filestatuses->surl); if (filestatuses->errstring) free(filestatuses->errstring); free(filestatuses); } #endif return(rc); } int DLL_DECL rfio_HsmIf_stat(const char *path, struct stat *st) { rfio_HsmIf_DIRcontext_t **myDIRcontext = NULL; #if defined(CNS_ROOT) struct Cns_filestat statbuf; #endif /* CNS_ROOT */ char *current_entry = NULL; char *dirpath = NULL; char *p = NULL; int rc = -1; #if defined(CNS_ROOT) if ( rfio_HsmIf_IsCnsFile(path) ) { Cglobals_get(&DIRcontext_key,(void **)&myDIRcontext, sizeof(rfio_HsmIf_DIRcontext_t)); if ( myDIRcontext != NULL && *myDIRcontext != NULL && (*myDIRcontext)->current_entry != NULL && (*myDIRcontext)->dirpath != NULL) { current_entry = (*myDIRcontext)->current_entry; dirpath = (*myDIRcontext)->dirpath; p = strrchr(path,'/'); if ( p != NULL ) p++; if ( p != NULL && strcmp(p,current_entry) == 0 && strncmp(path,dirpath,strlen(dirpath)) == 0 ) { statbuf = (*myDIRcontext)->Cns_st; rc = 0; } else (*myDIRcontext)->GetStat = 1; } if ( current_entry == NULL || p == NULL || dirpath == NULL || strcmp(p,current_entry) != 0 || strncmp(path,dirpath,strlen(dirpath)) != 0 ) rc = Cns_stat(path,&statbuf); if ( st != NULL ) { memset(st,0,sizeof(struct stat)); st->st_ino = (ino_t)statbuf.fileid; st->st_nlink = statbuf.nlink; st->st_uid = statbuf.uid; st->st_gid = statbuf.gid; st->st_mode = statbuf.filemode; st->st_size = (off_t)statbuf.filesize; st->st_atime = statbuf.atime; st->st_mtime = statbuf.mtime; st->st_ctime = statbuf.ctime; } } #endif /* CNS_ROOT */ return(rc); } int DLL_DECL rfio_HsmIf_stat64(const char *path, struct stat64 *st) { rfio_HsmIf_DIRcontext_t **myDIRcontext = NULL; #if defined(CNS_ROOT) struct Cns_filestat statbuf; #endif /* CNS_ROOT */ char *current_entry = NULL; char *dirpath = NULL; char *p = NULL; int rc = -1; #if defined(CNS_ROOT) if ( rfio_HsmIf_IsCnsFile(path) ) { Cglobals_get(&DIRcontext_key,(void **)&myDIRcontext, sizeof(rfio_HsmIf_DIRcontext_t)); if ( myDIRcontext != NULL && *myDIRcontext != NULL && (*myDIRcontext)->current_entry != NULL && (*myDIRcontext)->dirpath != NULL) { current_entry = (*myDIRcontext)->current_entry; dirpath = (*myDIRcontext)->dirpath; p = strrchr(path,'/'); if ( p != NULL ) p++; if ( p != NULL && strcmp(p,current_entry) == 0 && strncmp(path,dirpath,strlen(dirpath)) == 0 ) { statbuf = (*myDIRcontext)->Cns_st; rc = 0; } else (*myDIRcontext)->GetStat = 1; } if ( current_entry == NULL || p == NULL || dirpath == NULL || strcmp(p,current_entry) != 0 || strncmp(path,dirpath,strlen(dirpath)) != 0 ) rc = Cns_stat(path,&statbuf); if ( st != NULL ) { memset(st,0,sizeof(struct stat)); st->st_ino = statbuf.fileid; st->st_nlink = statbuf.nlink; st->st_uid = statbuf.uid; st->st_gid = statbuf.gid; st->st_mode = statbuf.filemode; st->st_size = statbuf.filesize; st->st_atime = statbuf.atime; st->st_mtime = statbuf.mtime; st->st_ctime = statbuf.ctime; } } #endif /* CNS_ROOT */ return(rc); } int DLL_DECL rfio_HsmIf_read(int fd, void *buffer, int size) { int rc = -1; #if defined(CNS_ROOT) /* * For CASTOR HSM this is a no-op. */ rc = size; #endif /* CNS_ROOT */ return(rc); } struct dirent DLL_DECL *rfio_HsmIf_readdir(DIR *dirp) { rfio_HsmIf_DIRcontext_t *tmp = NULL; rfio_HsmIf_DIRcontext_t **myDIRcontext = NULL; struct dirent *tmpdirent = NULL; #if defined(CNS_ROOT) struct Cns_direnstat *tmp_ds; #endif /* CNS_ROOT */ tmp = (rfio_HsmIf_DIRcontext_t *)dirp; #if defined(CNS_ROOT) if ( tmp->HsmType == RFIO_HSM_CNS ) { if ( tmp->GetStat == 0 ) tmpdirent = Cns_readdir((Cns_DIR *)(tmp->dirp)); else { tmp->current_entry = NULL; tmp_ds = Cns_readdirx((Cns_DIR *)(tmp->dirp)); if ( tmp_ds != NULL ) { tmp->Cns_st.fileid = tmp_ds->fileid; tmp->Cns_st.filemode = tmp_ds->filemode; tmp->Cns_st.nlink = tmp_ds->nlink; tmp->Cns_st.uid = tmp_ds->uid; tmp->Cns_st.gid = tmp_ds->gid; tmp->Cns_st.filesize = tmp_ds->filesize; tmp->Cns_st.atime = tmp_ds->atime; tmp->Cns_st.mtime = tmp_ds->mtime; tmp->Cns_st.ctime = tmp_ds->ctime; tmp->Cns_st.fileclass = tmp_ds->fileclass; tmp->Cns_st.status = tmp_ds->status; tmpdirent = tmp->de; tmpdirent->d_ino = tmp_ds->fileid; tmpdirent->d_reclen = tmp_ds->d_reclen; strcpy(tmpdirent->d_name,tmp_ds->d_name); tmp->current_entry = tmpdirent->d_name; } } Cglobals_get(&DIRcontext_key,(void **)&myDIRcontext, sizeof(rfio_HsmIf_DIRcontext_t *)); if ( myDIRcontext != NULL ) *myDIRcontext = tmp; } else serrno = EBADF; #endif /* CNS_ROOT */ return(tmpdirent); } int DLL_DECL rfio_HsmIf_rename(const char *opath, const char *npath) { int rc = -1; #if defined(CNS_ROOT) if ( rfio_HsmIf_IsCnsFile(opath) && rfio_HsmIf_IsCnsFile(npath) ) { rc =Cns_rename(opath,npath); } #endif /* CNS_ROOT */ return(rc); } void DLL_DECL rfio_HsmIf_rewinddir(DIR *dirp) { rfio_HsmIf_DIRcontext_t *tmp = NULL; tmp = (rfio_HsmIf_DIRcontext_t *)dirp; #if defined(CNS_ROOT) if ( tmp->HsmType == RFIO_HSM_CNS ) Cns_rewinddir((Cns_DIR *)(tmp->dirp)); #endif /* CNS_ROOT */ return; } int DLL_DECL rfio_HsmIf_rmdir(const char *path) { int rc = -1; #if defined(CNS_ROOT) if ( rfio_HsmIf_IsCnsFile(path) ) { rc = Cns_rmdir(path); } #endif /* CNS_ROOT */ return(rc); } int DLL_DECL rfio_HsmIf_unlink(const char *path) { int rc = -1; #if defined(CNS_ROOT) if ( rfio_HsmIf_IsCnsFile(path) ) { struct dpm_filestatus *filestatuses = NULL; int nbreplies = 0; rc = dpm_rm(1, (char **)&path, &nbreplies, &filestatuses); dpm_free_filest(nbreplies, filestatuses); } #endif /* CNS_ROOT */ return(rc); } int DLL_DECL rfio_HsmIf_write(int fd, void *buffer, int size) { int rc = -1; #if defined(CNS_ROOT) /* * For CASTOR HSM this is a no-op. */ rc = size; #endif /* CNS_ROOT */ return(rc); } int DLL_DECL rfio_HsmIf_FirstWrite(int fd, void *buffer, int size) { int rc = 0; int flags, written_to; int save_serrno; #if defined(CNS_ROOT) stage_hsm_t *hsmfile; #endif /* CNS_ROOT */ if ( size == 0 ) return (0); if ( size < 0 ) { serrno = EINVAL; return (-1); } #if defined(CNS_ROOT) if ( GetCnsFileDescriptor(fd,&flags,&hsmfile,&written_to) < 0 ) return (-1); if ( (flags & (O_WRONLY|O_RDWR|O_APPEND)) == 0 ) { serrno = EBADF; return (-1); } if ( written_to ) return (0); rc = SetCnsWrittenTo(fd); #endif /* CNS_ROOT */ return(rc); } int DLL_DECL rfio_HsmIf_IOError(int fd, int errorcode) { int rc = -1; #if defined(CNS_ROOT) /* * Should handle ENOSPC on write here */ rc = 0; #endif /* CNS_ROOT */ return(rc); } #if defined(CNS_ROOT) /* * Seach for a free index in the CnsFilesfdt table */ static int rfio_CnsFilesfdt_allocentry(s) int s; { #ifdef _WIN32 int i; int rc; if (Cmutex_lock((void *) CnsFilesfdt,-1) != 0) { return(-1); } /* Scan it */ for (i = 0; i < MAXRFD; i++) { if (CnsFilesfdt[i] == NULL) { rc = i; CnsFilesfdt[i] = &dummyCnsFile; goto _rfio_CnsFilesfdt_allocentry_return; } } serrno = ENOENT; rc = -1; _rfio_CnsFilesfdt_allocentry_return: if (Cmutex_unlock((void *) CnsFilesfdt) != 0) { return(-1); } return(rc); #else /* _WIN32 */ return(((s >= 0) && (s < MAXRFD)) ? s : -1); #endif /* _WIN32 */ } /* * Seach for a given index in the CnsFilesfdt table * On UNIX, if scanflag is FINDCNSFILES_WITH_SCAN, * a scan of table content is performed, otherwise * only boundary and content within the boundary * is performed. */ static int rfio_CnsFilesfdt_findentry(s,scanflag) int s; int scanflag; { int i; #ifdef _WIN32 int rc; if (Cmutex_lock((void *) CnsFilesfdt,-1) != 0) { return(-1); } /* Scan it */ for (i = 0; i < MAXRFD; i++) { if (CnsFilesfdt[i] != NULL) { if (CnsFilesfdt[i]->s == s) { rc = i; goto _rfio_CnsFilesfdt_findentry_return; } } } serrno = ENOENT; rc = -1; _rfio_CnsFilesfdt_findentry_return: if (Cmutex_unlock((void *) CnsFilesfdt) != 0) { return(-1); } return(rc); #else /* _WIN32 */ if (scanflag == FINDCNSFILES_WITH_SCAN) { for (i = 0; i < MAXRFD; i++) { if (CnsFilesfdt[i] != NULL) { if (CnsFilesfdt[i]->s == s) { return(i); } } } return(-1); } else { return(((s >= 0) && (s < MAXRFD) && (CnsFilesfdt[s] != NULL)) ? s : -1); } #endif /* _WIN32 */ } /* * Free a given index in the CnsFilesfdt table * Warning : the argument is REALLY an index */ static int rfio_CnsFilesfdt_freeentry(s) int s; { #ifdef _WIN32 if (Cmutex_lock((void *) CnsFilesfdt,-1) != 0) { return(-1); } if (CnsFilesfdt[s] != NULL) { if (CnsFilesfdt[s] != &dummyCnsFile) free(CnsFilesfdt[s]); CnsFilesfdt[s] = NULL; } if (Cmutex_unlock((void *) CnsFilesfdt) != 0) { return(-1); } #else /* _WIN32 */ if ((s >= 0) && (s < MAXRFD) && (CnsFilesfdt[s] != NULL)) { if (CnsFilesfdt[s] != &dummyCnsFile) free((char *)CnsFilesfdt[s]); CnsFilesfdt[s] = NULL; } #endif /* _WIN32 */ return(0); } #endif /* CNS_ROOT */ lcgdm-1.10.0/rfio/rfio_serror.man0000644000175000017500000000021410222773541016206 0ustar ellertellert.so ./rfio_perror.man .\" @(#)$RCSfile: rfio_serror.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud lcgdm-1.10.0/rfio/stat.c0000644000175000017500000000723510741353420014303 0ustar ellertellert/* * $Id: stat.c,v 1.3 2008/01/10 08:27:59 dhsmith Exp $ */ /* * Copyright (C) 1990-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: stat.c,v $ $Revision: 1.3 $ $Date: 2008/01/10 08:27:59 $ CERN/IT/PDP/DM Frederic Hemmer"; #endif /* not lint */ /* stat.c Remote File I/O - get file status */ #define RFIO_KERNEL 1 #include EXTERN_C int DLL_DECL rfio_smstat _PROTO((int, char *, struct stat *, int)); int DLL_DECL rfio_stat(filepath, statbuf) /* Remote file stat */ char *filepath; /* remote file path */ struct stat *statbuf; /* status buffer (subset of local used) */ { #if (defined(__alpha) && defined(__osf__)) return (rfio_stat64(filepath,statbuf)); #else int status ; #if defined(IRIX64) || defined(__ia64__) || defined(__x86_64) || defined(__ppc64__) struct stat64 statb64; if ((status = rfio_stat64(filepath,&statb64)) == 0) (void) stat64tostat(&statb64, statbuf); return (status); #else register int s; /* socket descriptor */ char *host, *filename; int rt, parserc ; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_stat(%s, %x)", filepath, statbuf); if (!(parserc = rfio_parseln(filepath,&host,&filename,RDLINKS))) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file */ TRACE(1,"rfio","rfio_stat: %s is an HSM path", filename); END_TRACE(); rfio_errno = 0; return(rfio_HsmIf_stat(filename,statbuf)); } TRACE(1, "rfio", "rfio_stat: using local stat(%s, %x)", filename, statbuf); END_TRACE(); rfio_errno = 0; status = stat(filename,statbuf); if ( status < 0 ) serrno = 0; return(status); } if (parserc < 0) { END_TRACE(); return(-1); } s = rfio_connect(host,&rt); if (s < 0) { END_TRACE(); return(-1); } END_TRACE(); status = rfio_smstat(s,filename,statbuf,RQST_STAT_SEC) ; (void) netclose(s); return (status); #endif #endif } int DLL_DECL rfio_stat64(filepath, statbuf) /* Remote file stat */ char *filepath; /* remote file path */ struct stat64 *statbuf; /* status buffer (subset of local used) */ { register int s; /* socket descriptor */ int status ; char *host, *filename; int rt,parserc ; int save_errno, save_serrno; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_stat64(%s, %x)", filepath, statbuf); if (!(parserc = rfio_parseln(filepath,&host,&filename,RDLINKS))) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file */ TRACE(1,"rfio","rfio_stat64: %s is an HSM path", filename); END_TRACE(); rfio_errno = 0; return(rfio_HsmIf_stat64(filename,statbuf)); } TRACE(1, "rfio", "rfio_stat64: using local stat64(%s, %x)", filename, statbuf); END_TRACE(); rfio_errno = 0; status = stat64(filename,statbuf); if ( status < 0 ) serrno = 0; return(status); } if (parserc < 0) { END_TRACE(); return(-1); } s = rfio_connect(host,&rt); if (s < 0) { END_TRACE(); return(-1); } END_TRACE(); status = rfio_smstat64(s,filename,statbuf,RQST_STAT64) ; save_serrno = serrno; save_errno = errno; (void) netclose(s); serrno = save_serrno; errno = save_errno; return (status); } lcgdm-1.10.0/rfio/popen.c0000644000175000017500000001340111336205452014443 0ustar ellertellert/* * $Id: popen.c 3172 2010-02-15 08:51:54Z baud $ */ /* * Copyright (C) 1994-2010 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: popen.c,v $ $Revision: 3172 $ $Date: 2010-02-15 09:51:54 +0100 (Mon, 15 Feb 2010) $ CERN/IT/PDP/DM Felix Hassine"; #endif /* not lint */ /* popen.c Remote pipe I/O - open file a file */ /* * System remote file I/O */ #define RFIO_KERNEL 1 #include #if defined(_WIN32) #define MAXHOSTNAMELEN 64 #else #include /* For MAXHOSTNAMELEN definition */ #endif #include #include #include #include "rfio.h" #include "rfio_rfilefdt.h" extern RFILE *rfilefdt[MAXRFD] ; #if (defined(__osf__) && defined(__alpha)) || defined(_WIN32) || defined(linux) extern char *cuserid(); #endif #if defined(__APPLE__) #include "Cpwd.h" #endif RFILE DLL_DECL *rfio_popen( rcom , type ) char * rcom ; char *type ; { char *host ; RFILE *rfp ; int rfp_index; char *p , *cp, *cp2 ; char command[MAXCOMSIZ]; /* command with remote syntax */ char *uname ; char *pcom ; int rt ; /* daemon is in the site or remote ? */ int rcode, status = 0 ; int len ; FILE *file, *popen() ; char localhost[MAXHOSTNAMELEN]; char buf[BUFSIZ] ; #if defined(__APPLE__) struct passwd *Cpw; #endif INIT_TRACE("RFIO_TRACE"); if ( (int)strlen(rcom) > MAXCOMSIZ -5 ) { serrno = SEUMSG2LONG ; return NULL ; } /* * get the stderr stream if any */ strcpy(command, rcom) ; strcat (command, " 2>&1"); /* * Allocate and initialize a remote file descriptor. */ if ((rfp = (RFILE *)malloc(sizeof(RFILE))) == NULL) { TRACE(2, "rfio", "rfio_popen: malloc(): ERROR occured (errno=%d)", errno); END_TRACE(); return NULL ; } rfio_setup(rfp) ; TRACE(3,"rfio","Allocated buffer at %x",rfp); cp = strchr(command,':') ; cp2 = strchr(command,' ') ; /* Bug fix when having a : in the command line but the command is local */ /* If the first space is before the ':', the command is really local */ if (cp2 < cp) cp = NULL; if (cp != NULL) { *cp = '\0' ; host = command ; pcom = cp + 1 ; } if ( gethostname(localhost, MAXHOSTNAMELEN) < 0) { TRACE(2,"rfio","gethostname() failed"); TRACE(2,"rfio","freeing RFIO descriptor at 0X%X", rfp); (void) free((char *)rfp); END_TRACE(); return NULL; } /* * file is local */ if ( (cp == NULL) || !strcmp( host, localhost) || !strcmp(host,"localhost") ) { TRACE(3,"rfio","popen(%s,%s): local mode",command,type) ; if (cp == NULL) #if defined(_WIN32) file = _popen(command, type); #else file = popen(command,type); #endif else #if defined(_WIN32) file = _popen(pcom, type); #else file = popen(pcom, type) ; #endif rfio_errno = 0; if ( file == NULL ) { TRACE(1,"rfio","popen() failed ,error %d", errno) ; TRACE(2,"rfio","freeing RFIO descriptor at 0X%X", rfp); serrno = 0; (void) free((char *)rfp); END_TRACE(); return (NULL) ; } rfp->fp_save = file; memcpy( &(rfp->fp), file, sizeof(FILE)) ; return ( rfp ) ; } /* * Parsing The command */ TRACE(2,"rfio", "RFIO descriptor allocated"); TRACE( 3, "rfio","rfio_popen(): host <%s>, command <%s>",host, pcom); if ( (rfp->s = rfio_connect(host , &rt)) < 0) { TRACE(2,"rfio","freeing RFIO descriptor at 0X%X", rfp); (void) free((char *)rfp); END_TRACE(); return NULL ; } /* * Remote file table is not large enough. */ if ((rfp_index = rfio_rfilefdt_allocentry(rfp->s)) == -1) { TRACE(2, "rfio", "freeing RFIO descriptor at 0X%X", rfp); (void) close(rfp->s); (void) free((char *)rfp); END_TRACE(); errno= EMFILE ; return NULL ; } rfilefdt[rfp_index]=rfp; p= buf ; #if defined(__APPLE__) Cpw = Cgetpwuid(geteuid()); if (Cpw == NULL) { TRACE(2, "rfio" ,"rfio_popen: Cgetpwuid error %s",sstrerror(serrno)); (void) free((char *)rfp); END_TRACE(); return NULL ; } uname = Cpw->pw_name; #else if ( (uname=cuserid(NULL)) == NULL) { TRACE(2, "rfio" ,"rfio_popen: cuserid error %s",strerror(errno)); (void) free((char *)rfp); END_TRACE(); return NULL ; } #endif len = 2*WORDSIZE+strlen(type)+strlen(pcom)+strlen(uname)+3 ; marshall_WORD(p,B_RFIO_MAGIC) ; marshall_WORD(p,RQST_POPEN) ; marshall_LONG(p,len) ; if (netwrite_timeout(rfp->s,buf, RQSTSIZE, RFIO_CTRL_TIMEOUT) != RQSTSIZE ) { TRACE(2,"rfio","rfio_popen: write(): ERROR occured (errno=%d)",errno); free((char *)rfp) ; END_TRACE() ; return NULL ; } p = buf ; marshall_WORD(p,rfp->uid) ; marshall_WORD(p,rfp->gid) ; marshall_STRING(p,type) ; marshall_STRING(p,pcom) ; marshall_STRING(p,uname) ; if (netwrite_timeout(rfp->s,buf, len, RFIO_CTRL_TIMEOUT) != len ) { TRACE(2,"rfio","rfio_popen: write(): ERROR occured (errno=%d)",errno); free((char *)rfp) ; END_TRACE() ; return NULL ; } /* * Getting status and current offset. */ if (netread_timeout(rfp->s,buf, WORDSIZE+LONGSIZE, RFIO_CTRL_TIMEOUT) != (WORDSIZE+LONGSIZE)) { TRACE(2, "rfio","rfio_popen: read(): ERROR occured (errno=%d)", errno); free((char *)rfp); END_TRACE(); return NULL ; } p = buf ; unmarshall_LONG(p, status) ; unmarshall_WORD(p, rcode) ; TRACE(1,"rfio","rfio_popen: return status(%d), rcode(%d) for fd(%d)",status,rcode, rfp->s) ; if (status < 0) { rfio_errno= rcode ; free((char *)rfp) ; END_TRACE() ; return NULL ; } else return rfilefdt[rfp_index] ; } lcgdm-1.10.0/rfio/rfio_lstat64.man0000644000175000017500000000021310222773541016172 0ustar ellertellert.so ./rfio_stat.man .\" @(#)$RCSfile: rfio_lstat64.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud lcgdm-1.10.0/rfio/fio.c0000644000175000017500000002434111336205452014104 0ustar ellertellert/* * $Id: fio.c 3172 2010-02-15 08:51:54Z baud $ */ /* * Copyright (C) 1990-2010 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: fio.c,v $ $Revision: 3172 $ $Date: 2010-02-15 09:51:54 +0100 (Mon, 15 Feb 2010) $ CERN/IT/PDP/DM Felix Hassine"; #endif /* not lint */ /* fortran.c C callable Fortran I/O */ /* * int usf_open(int *unit, char *file, int *append) returns irc * int udf_open(int *unit, char *file, int *lrecl , int *trunc) returns irc * int usf_write(int *unit, char *buf, int *nwrit) returns irc * int udf_write(int *unit, char *buf, int *nrec, int *nwrit) returns irc * int usf_read(int *unit, char *buf, int *nwant) returns irc * int udf_read(int *unit, char *buf, int *nrec, int *nwant) returns irc * int uf_close(int *unit) returns irc * void uf_cread(int *unit, char *buf, int *nrec, int *nwant, int *ngot, int *irc) * * unit = logical fortran unit; * file = filename; * filen= filename length, used only by fortran code; * append= open mode "append" for file when append > 0; * irc = error (errno) status if any occured, 0 otherwise; * reclen= record length for files open in DIRECT mode. * nrec= record number to be accessed. * * WARNING : uf_cread returns the following status values: * status = -1 a few bytes remain in the record * 0 EOR * 2 EOF * >=4 Error */ #define OPEN_MODE 0644 #define MAXFTNLUN 99 #include #include #include #include #include #define SET SEEK_SET #define CUR SEEK_CUR #define END SEEK_END #if defined(_WIN32) #include #else #include #endif static int lun2fd[MAXFTNLUN]; /* Fortran logical units to file descr. mapping */ /* * Fortran logical unit record length (direct access). -1 for * sequential access. Initialized by usf_open(), udf_open() */ static int lun2reclen[MAXFTNLUN]; static int tested = 0 ; /* Test is_usf() done ? */ int usf_open(unit, file,append,trunc) int *unit; char *file; int *append; int *trunc; { int fd; int flags; int errno1; if (*unit>MAXFTNLUN) return (EBADF); if (*unit <1) return (EINVAL); else { if (*append==0) { if (*trunc) flags= O_RDWR | O_CREAT | O_TRUNC; else flags= O_RDWR | O_CREAT; if ( (fd = open (file, flags , OPEN_MODE))<0 ) { errno1=errno; if ( (fd = open (file, O_RDONLY, OPEN_MODE) )<0 ) { if (errno1==EACCES) return(errno1); else return(errno); } } lun2fd[*unit-1]=fd; lun2reclen[*unit-1] = -1; } /* * In append mode we do not take * the value of trunc int account */ else { if( ( fd = open (file , O_RDWR | O_CREAT| O_APPEND , OPEN_MODE) ) <0) { return(errno); } else { lun2fd[*unit-1]=fd; lun2reclen[*unit-1] = -1;/* Not in Direct access */ } } } return (0); } int udf_open(unit, file, lrecl,trunc) int *unit; char *file; int *lrecl; int *trunc; { int flags; int fd; int errno1; if ( (*unit>MAXFTNLUN) || (*unit<1) || (*lrecl<0) || ( (*lrecl) % 8 ) ) return(EBADF); else { if (*trunc) { flags= O_RDWR | O_CREAT | O_TRUNC; } else flags= O_RDWR | O_CREAT ; if ( ( fd = open (file, flags , OPEN_MODE) ) <0 ) { errno1=errno; if ( (fd = open (file, O_RDONLY , OPEN_MODE)) <0 ) { if ( errno1==EACCES ) return(errno1); else return(errno); } } lun2fd[*unit-1]=fd; lun2reclen[(*unit) -1]= (*lrecl) ; } return (0); } int usf_write(unit, buf, nwrit) int *unit; char *buf; int *nwrit; { int fd,reclen; fd=lun2fd[*unit-1]; reclen=lun2reclen[*unit-1]; if (reclen != -1) { return(ENOENT); } else { if (*nwrit > 0) write( fd, nwrit , sizeof(int) ); if ( write ( fd , (char *)buf , *nwrit) <0 ) { return(errno); } if (*nwrit >0) write( fd, nwrit , sizeof(int) ); return(0); } } int udf_write(unit, buf, nrec, nwrit) int *unit; char *buf; int *nrec; int *nwrit; { int fd; int reclen,i; int zero=0; fd=lun2fd[*unit-1]; reclen=lun2reclen[*unit-1]; if (reclen <=0 ) { return(ENOENT); } else { if (*nwrit <= reclen) { lseek(fd , (*nrec-1)*reclen , SET ); if ( write ( fd , (char *)buf , *nwrit) <0 ){ return(errno); } else { for (i= (*nwrit) +1; i <=reclen; i++) { write ( fd , &zero , 1); } return(0); } } else { return(EINVAL); } } } /* * usf_read performs the read for unformatted sequential files. * irc is given the value 0 if no error occured, * and the C errno value otherwise. */ int usf_read(unit, buf, nwant) int *unit; char *buf; int *nwant; { int fd,reclen; int c,d; int got; fd=lun2fd[*unit-1]; reclen=lun2reclen[*unit-1]; if (reclen != -1) { *nwant=0; errno = ENOENT ; return(ENOENT); } else { if ( (read(fd, &c , sizeof (int) ) ) <0 ) { *nwant=0; return(errno); } else { if (*nwant >=c) { *nwant=c; if ( (got=read(fd,buf,*nwant) )<0) { *nwant=0; return(errno); } else { *nwant=got; } } else { if ( (got=read(fd,buf,*nwant) )<0 ) { *nwant=0; return(errno); } else { *nwant=got; } lseek(fd, c-got, CUR); } } /* Checking that the following integer read is equal * to the first one : */ if ( ( read( fd, &d , sizeof (int) ) <0 ) ) { return(errno); } else { if (c != d ) { serrno = SEBADFFORM ; return(ESPIPE) ; } } return(0); } } int udf_read(unit, buf, nrec, nwant) int *unit; char *buf; int *nrec; int *nwant; { int fd=lun2fd[*unit-1]; int reclen=lun2reclen[*unit-1]; int got; if ((reclen<=0) ||(*unit>MAXFTNLUN) || (*unit<1) || (*nrec<0) || (*nwant < 0)) { *nwant=0; if (reclen<=0) { errno = ENOENT ; return(ENOENT); } else { errno = EINVAL ; return(EINVAL) ; } } else { if (*nwant>reclen) *nwant=reclen; lseek(fd , reclen*(*nrec-1) , SET ) ; if ( ( got=read(fd, buf , *nwant) ) <0) { *nwant=0; return(errno); } else{ *nwant=got; return(0); } } } int uf_close(unit) int *unit; { if ( close( lun2fd[*unit-1] ) < 0 ) { return(errno); } else { lun2reclen[*unit-1] = -1; return(0); } } /* * uf_cread replaces the frdc function */ void uf_cread(unit, buf, nrec, nwant, ngot, irc) int *unit; char *buf; int *nrec; int *nwant; int *ngot; int *irc; { int fd=lun2fd[*unit-1]; int sequential=0; int reclen=lun2reclen[*unit-1]; int len=0; int rcode=0; /* * detecting wether the file is * Sequentially * or Directly * accessed in fortran */ if (*nwant == 0) { *ngot = 0; *irc= -1 ; /*Still to read */ return ; } if (reclen<0) sequential=1; /* The file is sequential */ if (!sequential) { /* Direct access */ if (*nwant > reclen) *nwant=reclen; lseek(fd, (*nrec -1)*reclen, SET); rcode=read(fd,buf, (*nwant) ); if (rcode<0) { (*irc)=5; /* Error */ (*ngot)=0; } else { if ( (rcode >=0 ) && (rcode < *nwant) ) (*irc)=2; /* EOF reached */ else if ( (rcode == *nwant) && (*nwant==reclen) ) (*irc)=0; /* EOR reached */ else if ( (rcode == *nwant) && (*nwant < reclen) ) (*irc)= -1; /* There is still bytes to read */ (*ngot)=rcode; } } else { /* Sequential access */ int rrc =0 ; if (!tested) { if ( (rrc = is_usf(fd)) == 0 || rrc == 3 ) { *irc = SEBADFFORM ; *ngot = 0 ; return ; } tested ++ ; } rcode=read(fd,&len, sizeof(int) ); if (rcode <0) { (*irc)=5; /* Error */ (*ngot)=0; } else if (rcode==0){ (*irc)=2; /* EOF reached */ (*ngot)=0; } else { if ( len <*nwant ) { *ngot=len; *nwant=len; } if ( (rcode=read(fd, buf, *nwant) ) <0) { *irc=5; /* Error */ *ngot=0; } else { *ngot=rcode; if (rcode == 0) *irc=2 ; /* EOF */ else if (rcode < *nwant) *irc=2 ; /* EOF */ else if ( (rcode== *nwant) && (len > *nwant) ) (*irc)= -1 ; /* Still to read */ else if ((rcode == *nwant) && (len == *nwant) ) (*irc)=0 ; /* EOR */ /* Skipping the end of record if * necessary, and also the length * integer. */ lseek(fd,len-(*ngot)+sizeof(int), CUR); } } } } /* * is the disk file an unformatted sequential file ? * returns -1 on failure, * 0 if not sequential file * 1 if file may be unformatted sequential * 2 file is empty * 3 first record is null * It leaves the file pointer at the place it was. * */ int is_usf( fd ) int fd ; { int len,llen ; int rcode,rc ; int curr ; curr = lseek(fd,0,CUR) ; if (curr > 0) lseek(fd,0, SET) ; if (curr < 0) return -1 ; if ( (rcode = read(fd,&len,sizeof(int))) < 0 ) return -1 ; if (rcode == 0 ) { lseek(fd,curr,SET) ; return 2 ; } if ( len < 0 ) { lseek(fd,curr,SET) ; return 0 ; } if (len == 0){ lseek(fd,curr,SET) ; return 3 ; } else { rcode=lseek(fd,len, CUR) ; if (rcode < 0) { lseek(fd,curr,SET) ; return 0 ; } rc=read(fd,&llen,sizeof(int)); if (rc < sizeof(int)) { /* We need at least 1 record to decide * it is sequential */ lseek(fd,curr,SET) ; return 0 ; } if (llen != len) { lseek(fd,curr,SET) ; return 0 ; } else { lseek(fd,curr,SET) ; return 1 ; } } } lcgdm-1.10.0/rfio/readdir.c0000644000175000017500000001115010222773541014735 0ustar ellertellert/* * $Id: readdir.c,v 1.1 2005/03/31 13:13:01 baud Exp $ */ /* * Copyright (C) 1990-2003 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: readdir.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:01 $ CERN/IT/PDP/DM Olof Barring"; #endif /* not lint */ /* readdir.c Remote File I/O - read a directory entry */ #include /* system logger */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rdirfdt.h" /* * Remote directory read */ struct dirent DLL_DECL *rfio_readdir(dirp) RDIR *dirp; { int status ; /* Status and return code from remote */ int rcode; int req; int s; int s_index; int namlen; struct dirent *de; char *p; extern RDIR *rdirfdt[MAXRFD]; char rfio_buf[BUFSIZ]; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_readdir(%x)", dirp); /* * Search internal table for this directory pointer * Check first that it's not the last one used */ s_index = rfio_rdirfdt_findptr(dirp,FINDRDIR_WITH_SCAN); /* * The directory is local. */ if (s_index == -1) { TRACE(2,"rfio","rfio_readdir: check if HSM directory"); if ( rfio_HsmIf_IsHsmDirEntry((DIR *)dirp) != -1 ) { de = rfio_HsmIf_readdir((DIR *)dirp); } else { TRACE(2,"rfio","rfio_readdir: using local readdir(%x)", dirp); #if defined(_WIN32) de = NULL; serrno = SEOPNOTSUP; #else /* _WIN32 */ de = readdir((DIR *)dirp); if ( ! de ) serrno = 0; #endif /* _WIN32 */ } END_TRACE(); return(de); } s = rdirfdt[s_index]->s; /* * Associate the static dirent area allocate with this * directory descriptor. */ de = (struct dirent *)rdirfdt[s_index]->dp.dd_buf; /* * Checking magic number. */ if (rdirfdt[s_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION ; rfio_rdirfdt_freeentry(s_index); (void) close(s) ; END_TRACE(); return(NULL); } p = rfio_buf; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_READDIR) ; TRACE(2,"rfio","rfio_readdir: writing %d bytes",RQSTSIZE) ; if (netwrite_timeout(s,rfio_buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2,"rfio","rfio_readdir: write(): ERROR occured (errno=%d)", errno) ; END_TRACE() ; return(NULL) ; } TRACE(2, "rfio", "rfio_readdir: reading %d bytes",WORDSIZE+3*LONGSIZE) ; if ( netread_timeout(s,rfio_buf,WORDSIZE+3*LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+3*LONGSIZE) ) { TRACE(2,"rfio","rfio_readdir: read(): ERROR occured (errno=%d)", errno); END_TRACE(); return(NULL) ; } p= rfio_buf ; unmarshall_WORD(p,req) ; /* RQST_READDIR */ unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; unmarshall_LONG(p,namlen) ; if ( status < 0 ) { rfio_errno= rcode ; if ( rcode == 0 ) serrno = SENORCODE ; END_TRACE() ; return(NULL) ; } if ( namlen > 0 ) { TRACE(2, "rfio", "rfio_readdir: reading %d bytes",namlen) ; memset(de->d_name,'\0',MAXFILENAMSIZE); /* Directory name is of a small size, so I put RFIO_CTRL_TIMEOUT instead */ /* of RFIO_DATA_TIMEOUT */ if ( netread_timeout(s,de->d_name,namlen,RFIO_CTRL_TIMEOUT) != namlen ) { TRACE(2,"rfio","rfio_readdir: read(): ERROR occured (errno=%d)", errno); END_TRACE(); return(NULL) ; } /* * Update the directory offset. */ dirp->offset++; dirp->dp.dd_loc = dirp->offset; de->d_reclen = sizeof(struct dirent) + namlen; #if !defined(SOLARIS) && !defined(sgi) && !defined(linux) de->d_namlen = namlen; #endif #ifdef SOLARIS de->d_off = dirp->offset; #endif #ifdef _AIX de->d_offset = dirp->offset; #endif } else { TRACE(2,"rfio","rfio_readdir: no more directory entries"); END_TRACE(); return(NULL); } END_TRACE(); return(de); } #if !defined(SOLARIS) && !defined(linux) struct dirent DLL_DECL *rfio_readdir64(dirp) RDIR *dirp; { return (rfio_readdir(dirp)); } #else struct dirent64 DLL_DECL *rfio_readdir64(dirp) RDIR *dirp; { struct dirent64 *de; struct dirent *de32; ino_t ino; short namlen; off_t offset; if ((de32 = rfio_readdir(dirp)) == NULL) return(NULL); ino = de32->d_ino; offset = de32->d_off; namlen = strlen(de32->d_name); de = (struct dirent64 *) de32; memmove (de->d_name, de32->d_name, namlen + 1); de->d_ino = ino; de->d_off = offset; de->d_reclen = ((&de->d_name[0] - (char *) de + namlen + 8) / 8) * 8; return(de); } #endif lcgdm-1.10.0/rfio/rfcat.c0000644000175000017500000000276411070701342014425 0ustar ellertellert/* * $Id: rfcat.c,v 1.2 2008/10/01 14:02:10 dhsmith Exp $ */ /* * Copyright (C) 2001-2008 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rfcat.c,v $ $Revision: 1.2 $ $Date: 2008/10/01 14:02:10 $ CERN/IT/PDP/DM Jean-Philippe Baud"; #endif /* not lint */ #include #include #include #include #if defined(_WIN32) #include #endif #include "rfio_api.h" main(argc, argv) int argc; char **argv; { int errflg = 0; int i; #if defined(_WIN32) WSADATA wsadata; if (WSAStartup (MAKEWORD (2, 0), &wsadata)) { fprintf (stderr, "WSAStartup unsuccessful\n"); exit (2); } #endif if (argc == 1) errflg = catfile ("-"); else for (i = 1; i < argc; i++) errflg += catfile (argv[i]); #if defined(_WIN32) WSACleanup(); #endif exit (errflg ? 1 : 0); } catfile(inpfile) char *inpfile; { char buf [32768]; int c; int rc; FILE *s; int v; /* Streaming opening is always better */ v = RFIO_STREAM; rfiosetopt (RFIO_READOPT, &v, 4); if (strcmp (inpfile, "-") == 0) s = stdin; else if ((s = rfio_fopen64 (inpfile, "r")) == NULL) { rfio_perror (inpfile); return (1); } while ((c = rfio_fread (buf, 1, sizeof(buf), s)) > 0) { if ((rc = fwrite (buf, 1, c, stdout)) < c) { fprintf (stderr, "rfcat %s: %s\n", inpfile, strerror ((rc < 0) ? errno : ENOSPC)); if (strcmp (inpfile, "-")) rfio_fclose (s); return (1); } } if (strcmp (inpfile, "-")) rfio_fclose (s); return (0); } lcgdm-1.10.0/rfio/rfio_stat.man0000644000175000017500000001030310222773541015645 0ustar ellertellert.\" .\" $Id: rfio_stat.man,v 1.1 2005/03/31 13:13:03 baud Exp $ .\" .\" @(#)$RCSfile: rfio_stat.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2002 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_STAT 3 "$Date: 2005/03/31 13:13:03 $" CASTOR "Rfio Library Functions" .SH NAME rfio_stat \- get information about a file or directory .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_stat (const char *" path ", struct stat *" statbuf ");" .br .BI "int rfio_fstat (int " s ", struct stat *" statbuf ");" .br .BI "int rfio_lstat (const char *" path ", struct stat *" statbuf ");" .br .BI "int rfio_mstat (const char *" path ", struct stat *" statbuf ");" .br .BI "int rfio_mstat_reset ();" .br .BI "int rfio_end ();" .br .br .sp Under Linux, for large files: .br .B #define _LARGEFILE64_SOURCE .br .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_stat64 (const char *" path ", struct stat64 *" statbuf ");" .br .BI "int rfio_fstat64 (int " s ", struct stat64 *" statbuf ");" .br .BI "int rfio_lstat64 (const char *" path ", struct stat64 *" statbuf ");" .br .BI "int rfio_mstat64 (const char *" path ", struct stat64 *" statbuf ");" .sp For large files, under other systems: .br .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_stat64 (const char *" path ", struct stat64 *" statbuf ");" .br .BI "int rfio_fstat64 (int " s ", struct stat64 *" statbuf ");" .br .BI "int rfio_lstat64 (const char *" path ", struct stat64 *" statbuf ");" .br .BI "int rfio_mstat64 (const char *" path ", struct stat64 *" statbuf ");" .SH DESCRIPTION .B rfio_stat gets information about a file or directory. .LP .B rfio_lstat is identical to .B rfio_stat except for symbolic links. In this case, the link itself is statted and not followed. .LP .B rfio_fstat is identical to .B rfio_stat but works on the file descriptor .B s returned by .BR rfio_open . .LP .B rfio_mstat is identical to .B rfio_stat but keeps the connection open to the server unless there are more than MAXMCON connections already opened. This is useful when issuing a series of stat calls. The last .B rfio_mstat call should be followed by a call to .BR rfio_end . .LP .B rfio_mstat_reset is to be used when your program is forking. In such a case the permanent connections opened with .B rfio_mstat become shared between the parent and the child. Use .B rfio_mstat_reset to perform the necessary reset and close of the socket file descriptor in the parent or the child in order to be sure that only of them will receice an answer from the RFIO daemon. .LP See NOTES section below. .TP .I path specifies the logical pathname relative to the current directory or the full pathname. .TP .I statbuf is a pointer to a .B stat structure, receiving result of your query. .P The 64 bits functions must be used for large files. They have the same syntax as the normal stat functions except that they use a .B stat64 structure. .SH RETURN VALUE This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH NOTES Multiple connections using rfio_mstat are thread-safe but not process-wide, therefore a forked child can share file descriptors opened with rfio_mstat by its parent. Use .B rfio_mstat_reset in such case. .P Multiple connections behaviour is undefined if you work in a multi-threaded environment and with threads \fBnot\fP created using the CASTOR's \fBCthread\fP interface. .SH ERRORS .TP 1.3i .B ENOENT The named file/directory does not exist or is a null pathname. .TP .B EBADF .I s is not a valid file descriptor. .TP .B EACCES Search permission is denied on a component of the .I path prefix. .TP .B EFAULT .I path or .I statbuf is a NULL pointer. .TP .B ENOTDIR A component of .I path prefix is not a directory. .TP .B ENAMETOOLONG The length of .I path exceeds .B CA_MAXPATHLEN or the length of a .I path component exceeds .BR CA_MAXNAMELEN . .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR Castor_limits(4) , .BR rfio_chmod(3) , .BR rfio_chown(3) , .BR Cthread(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/fchmod.c0000644000175000017500000000735510222773541014577 0ustar ellertellert/* * $Id: fchmod.c,v 1.1 2005/03/31 13:13:00 baud Exp $ */ /* * Copyright (C) 2002 by CERN/IT/DS/HSM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: fchmod.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:00 $ CERN/IT/DS/HSM Jean-Philippe Baud"; #endif /* not lint */ /* fchmod.c Remote File I/O - change file mode of a file */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rfilefdt.h" #include /* malloc prototype */ /* * Remote file fchmod */ int DLL_DECL rfio_fchmod(s, mode) int s; int mode; /* remote directory mode */ { int status ; char * p ; char * trp ; int temp=0 ; char rfio_buf[BUFSIZ]; int s_index = -1; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_fchmod(%d, %o)", s, mode); /* * The file is local */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1) { TRACE(2, "rfio", "rfio_fchmod: using local fchmod(%d, %o)", s, mode); status = fchmod(s, mode); if ( status < 0 ) serrno = 0; rfio_errno = 0; END_TRACE(); return(status); } /* * Checking magic number. */ if (rfilefdt[s_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(s_index); (void) close(s) ; END_TRACE(); return(-1); } /* * Sending request. */ p= rfio_buf ; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_FCHMOD); marshall_LONG(p, mode); TRACE(2,"rfio","rfio_fchmod: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(s,rfio_buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio", "rfio_fchmod: write(): ERROR occured (errno=%d)", errno); END_TRACE(); return(-1); } /* * Getting data from the network. */ for(;;) { WORD req ; LONG rcode ; LONG msgsiz ; TRACE(2, "rfio", "rfio_fchmod: reading %d bytes",rfilefdt[s_index]->_iobuf.hsize) ; if (netread_timeout(s,rfio_buf,rfilefdt[s_index]->_iobuf.hsize,RFIO_DATA_TIMEOUT) != rfilefdt[s_index]->_iobuf.hsize) { TRACE(2, "rfio", "rfio_fchmod: read(): ERROR occured (errno=%d)", errno); if ( temp ) (void) free(trp) ; END_TRACE() ; return(-1); } p = rfio_buf ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; unmarshall_LONG(p, msgsiz) ; switch(req) { case RQST_FCHMOD: rfio_errno= rcode ; if ( temp ) (void) free(trp) ; TRACE(1,"rfio","rfio_fchmod: return status %d, rcode %d",status,rcode) ; END_TRACE() ; return(status) ; case RQST_READAHEAD: case RQST_LASTSEEK: case RQST_PRESEEK: /* * At this point a temporary buffer may need to be created * to receive data which is going to be thrown away. */ if ( temp == 0 ) { if ( rfilefdt[s_index]->_iobuf.base==NULL || rfilefdt[s_index]->_iobuf.dsize lcgdm-1.10.0/rfio/rfiod.man0000644000175000017500000000376411763665646015014 0ustar ellertellert.\" .\" $Id: rfiod.man 6384 2012-06-06 14:39:34Z rocha $ .\" .\" @(#)$RCSfile: rfiod.man,v $ $Revision: 6384 $ $Date: 2012-06-06 16:39:34 +0200 (Wed, 06 Jun 2012) $ CERN/IT/PDP/DM .\" Copyright (C) 1990-2010 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIOD 8 "$Date: 2012-06-06 16:39:34 +0200 (Wed, 06 Jun 2012) $" CASTOR "Rfio Administrator Commands" .SH NAME rfiod\- Remote file access daemon .SH SYNOPSIS .B rfiod [ .B -d ] [ .BI -f " filename" ] [ .B -l ] [ .BI -p " port" ] [ .B -s ] [ .B -t ] [ .B -4 | .B -6 ] [ .BI -L " log_level" ] .SH DESCRIPTION .IX "\fLrfiod\fR" .IX tcp rfiod start the daemon handling remote file access requests. This command is usually executed at system startup time .RB ( /etc/rc.local ). rfiod uses for the streaming mode (v3) one control port and one data port. The range of data ports to be used by rfiod can be set with the environment variable RFIO_PORT_RANGE. .SH OPTIONS .TP .B \-d Turn on printing of debug messages. Default output device is stderr. .TP .BI \-f " filename" Output filename for error, logging and debugging messages. Normal error messages are sent to syslog unless otherwise specified. Two filenames are special : "stderr", which will send messages to standard error and "syslog" which will send to syslog. .TP .B \-l Turn on printing of log messages. Default output device is in .BR /var/log/rfio/log . .TP .BI \-p " port" Specify a network port for the service to listen on. If this option is not given the value RFIO_PORT defined in rfio_constants.h is used. .TP .B \-s Turn on Standalone mode. This option should always be set when rfiod is not started by inetd. .TP .B \-t Turn on single threaded mode. Useful for debugging as no processes are created. .TP .B -4 only try to listen on IPv4 addresses .TP .B -6 only try to listen on IPv6 addresses .TP .BI \-L " log_level" Specify the logging level. Default 6 (LOG_INFO). .SH EXAMPLE .RS .HP /usr/local/bin/rfiod -sl .RE .SH "SEE ALSO" .BR syslog(8) , .B tcp(4) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/read.c0000644000175000017500000004235511433144506014247 0ustar ellertellert/* * $Id: read.c 3750 2010-08-19 06:03:50Z baud $ */ /* * Copyright (C) 1990-2010 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: read.c,v $ $Revision: 3750 $ $Date: 2010-08-19 08:03:50 +0200 (Thu, 19 Aug 2010) $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy, F. Hassine"; #endif /* not lint */ /* read.c Remote File I/O - read a file */ #include /* system logger */ #include #include /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rfilefdt.h" /* Forward reference */ static int rfio_preread(); /* * Remote file read */ int DLL_DECL rfio_read(s, ptr, size) void *ptr; int s, size; { int s_index; /* Remote file ? */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) != -1) { if (rfilefdt[s_index]->version3 == 1) { /* New V3 stream protocol for sequential transfers */ return(rfio_read_v3(s,(char *)ptr,size)); } else return(rfio_read_v2(s,(char *)ptr,size)); } else return(rfio_read_v2(s,(char *)ptr,size)); } int rfio_read_v2(s, ptr, size) char *ptr; int s, size; { int status ; /* Status and return code from remote */ int HsmType, save_errno; int nbytes ; /* Bytes still to read */ int s_index; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_read(%d, %x, %d)", s, ptr, size); nbytes = size; if (nbytes == 0) { END_TRACE(); return(0); } #if defined (CLIENTLOG) /* Client logging */ rfio_logrd(s,size); #endif /* * Check HSM type. The CASTOR HSM uses normal RFIO (local or remote) * to perform the I/O. Thus we don't call rfio_HsmIf_read(). */ HsmType = rfio_HsmIf_GetHsmType(s,NULL); if ( HsmType > 0 ) { if ( HsmType != RFIO_HSM_CNS ) { status = rfio_HsmIf_read(s,ptr,size); if ( status == -1 ) { save_errno = errno; rfio_HsmIf_IOError(s,errno); errno = save_errno; } END_TRACE(); return(status); } } /* * The file is local. */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1) { TRACE(2,"rfio","rfio_read: using local read(%d, %x, %d)", s, ptr, nbytes); status = read(s, ptr, nbytes); if ( status < 0 ) serrno = 0; if ( HsmType == RFIO_HSM_CNS ) { save_errno = errno; rfio_HsmIf_IOError(s,errno); errno = save_errno; } END_TRACE(); rfio_errno = 0; return(status); } /* * Checking magic number. */ if (rfilefdt[s_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(s_index); (void) close(s) ; END_TRACE(); return(-1); } /* * Checking mode 64. */ if (rfilefdt[s_index]->mode64) { status = rfio_read64_v2(s, ptr, size); END_TRACE(); return(status); } if ( ! rfilefdt[s_index]->socset ) { char * ifce, *p ; int bufsize ; extern char * getconfent() ; extern char * getifnam() ; rfilefdt[s_index]->socset ++ ; ifce = ( char * ) getifnam(s) ; bufsize= DEFIOBUFSIZE ; if ( (p = getconfent("RFIORCVBUF", ifce , 0)) != NULL ) { if ((bufsize = atoi(p)) <= 0) { bufsize = DEFIOBUFSIZE; } } else /* reset error code */ serrno=0; /* * Set socket buffer size. */ TRACE(2, "rfio", "rfio_read: setsockopt(SOL_SOCKET, SO_RCVBUF): for %s : %d", ifce, bufsize); if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&(bufsize), sizeof(bufsize)) == -1) { TRACE(2, "rfio" ,"rfio_read: setsockopt(SO_RCVBUF)"); syslog(LOG_ALERT, "rfio: setsockopt(SO_RCVBUF): %s", strerror(errno)); } } /* * A preseek has been issued. If rfio_preread() does not succeed * in its search for the correct data, usual operations are done. */ if ( rfilefdt[s_index]->preseek ) { int offset ; /* Saving current offset */ offset= rfilefdt[s_index]->offset ; status= rfio_preread(s, ptr, size) ; if ( status != -2 ) { END_TRACE() ; return status ; } rfilefdt[s_index]->offset= offset ; rfilefdt[s_index]->lseekhow= SEEK_SET ; rfilefdt[s_index]->lseekoff= offset ; } /* * The file mark has to be repositionned. * Local flags are reset. */ if ( rfilefdt[s_index]->lseekhow != -1 ) { rfilefdt[s_index]->eof= 0 ; rfilefdt[s_index]->readissued= 0 ; if ( rfilefdt[s_index]->_iobuf.base ) { rfilefdt[s_index]->_iobuf.count= 0 ; rfilefdt[s_index]->_iobuf.ptr= iodata(rfilefdt[s_index]) ; } } /* * I/O are unbuffered. */ if ( rfilefdt[s_index]->_iobuf.base == NULL ) { /* * If the end of file has been reached, there is no * no need for sending a request across. */ if ( rfilefdt[s_index]->eof == 1 ) { END_TRACE() ; return 0 ; } /* * For unbuffered read ahead I/O, the request * size has to be always the same one. */ if ( rfilefdt[s_index]->ahead && rfilefdt[s_index]->_iobuf.dsize && rfilefdt[s_index]->_iobuf.dsize != size ) { TRACE(2,"rfio","rfio_read: request size %d is incompatible with the previous one %d", size,rfilefdt[s_index]->_iobuf.dsize) ; errno= EINVAL ; END_TRACE() ; return -1 ; } rfilefdt[s_index]->_iobuf.dsize= size ; /* * Sending a request to fill the * user buffer. */ TRACE(2,"rfio","rfio_read: call rfio_filbuf(%d,%x,%d) at line %d", s,ptr,size,__LINE__); if ( (status= rfio_filbuf(s,ptr,size)) < 0 ) { TRACE(2,"rfio","rfio_read: rfio_filbuf returned %d",status); rfilefdt[s_index]->readissued= 0 ; if ( HsmType == RFIO_HSM_CNS ) rfio_HsmIf_IOError(s,(rfio_errno > 0 ? rfio_errno : serrno)); END_TRACE() ; return status ; } TRACE(2,"rfio","rfio_read: rfio_filbuf returned %d",status); rfilefdt[s_index]->offset += status ; if ( status != size ) { TRACE(2,"rfio","rfio_read: status=%d != size=%d, set eof",status,size); rfilefdt[s_index]->eof= 1 ; rfilefdt[s_index]->readissued= 0 ; } END_TRACE() ; return status ; } /* * I/O are buffered. */ for(;;) { int count; /* * There is still some valid data in cache. */ if ( rfilefdt[s_index]->_iobuf.count ) { count= (nbytes>rfilefdt[s_index]->_iobuf.count) ? rfilefdt[s_index]->_iobuf.count : nbytes ; TRACE(2, "rfio", "rfio_read: copy %d cached bytes from 0X%X to 0X%X",count, rfilefdt[s_index]->_iobuf.ptr, ptr); (void) memcpy(ptr,rfilefdt[s_index]->_iobuf.ptr,count) ; ptr+= count ; nbytes -= count ; rfilefdt[s_index]->_iobuf.count -= count ; rfilefdt[s_index]->_iobuf.ptr += count ; } /* * User request has been satisfied. */ if ( nbytes == 0 ) { rfilefdt[s_index]->offset += size ; TRACE(2,"rfio", "rfio_read: User request has been satisfied, size=%d, offset=%d, count=%d, s=%d, eof=%d",size,rfilefdt[s_index]->offset,rfilefdt[s_index]->_iobuf.count,s,rfilefdt[s_index]->eof); END_TRACE() ; return size ; } /* * End of file has been reached. * The user is returned what's left. */ if (rfilefdt[s_index]->eof == 1) { TRACE(2,"rfio", "rfio_read: End of file (s=%d, eof=%d) has been reached. size=%d, nbytes=%d, offset=%d",s,rfilefdt[s_index]->eof,size,nbytes,rfilefdt[s_index]->offset); rfilefdt[s_index]->offset += size - nbytes ; END_TRACE() ; return ( size - nbytes ) ; } /* * Buffer is going to be fill up. */ rfilefdt[s_index]->_iobuf.count = 0; rfilefdt[s_index]->_iobuf.ptr = iodata(rfilefdt[s_index]); /* * If file offset is going to be moved we have to remember what the * offset should be within the new file buffer. * Note: file offset and buffer offset may be different in case * several consecutive lseek() calls has been issued between two reads. */ if ( rfilefdt[s_index]->lseekhow != -1 ) { count = rfilefdt[s_index]->offset - rfilefdt[s_index]->lseekoff; } else { count = 0; } TRACE(2,"rfio","rfio_read: call rfio_filbuf(%d,%d,%d) at line %d",s,rfilefdt[s_index]->_iobuf.base,rfilefdt[s_index]->_iobuf.dsize,__LINE__); status= rfio_filbuf(s,rfilefdt[s_index]->_iobuf.base,rfilefdt[s_index]->_iobuf.dsize) ; TRACE(2,"rfio","rfio_read: rfio_filbuf returned %d",status); if ( status < 0 ) { rfilefdt[s_index]->readissued= 0 ; if ( HsmType == RFIO_HSM_CNS ) rfio_HsmIf_IOError(s,(rfio_errno > 0 ? rfio_errno : serrno)); END_TRACE() ; return -1 ; } if ( status != rfilefdt[s_index]->_iobuf.dsize ) { TRACE(2,"rfio","rfio_read: dsize=%d, set eof",rfilefdt[s_index]->_iobuf.dsize); rfilefdt[s_index]->eof= 1 ; rfilefdt[s_index]->readissued= 0 ; } rfilefdt[s_index]->_iobuf.count= status ; /* * Make sure that file offset is correctly set within the buffer. * Note: file offset and buffer offset may be different in case * several consecutive lseek() calls has been issued between two reads. */ rfilefdt[s_index]->_iobuf.count -= count; rfilefdt[s_index]->_iobuf.ptr += count; } } /* * Called when working in preseek() mode. * Return code of -2 tells that rfio_preread() * has not been able to satisfy the request. */ static int rfio_preread(s,buffer,size) int s ; char * buffer ; /* Pointer to user buffer. */ int size ; /* How many bytes do we want to read ? */ { int ncount ; int ngot ; int s_index; TRACE(1,"rfio","rfio_preread(%d,%x,%d)",s,buffer,size) ; ngot= 0 ; ncount= 0 ; if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1) { serrno = SEINTERNAL; END_TRACE() ; return -1 ; } do { char * p ; /* Pointer to data buffer. */ int status ; int rcode ; int offset ; int len ; p= rfilefdt[s_index]->_iobuf.ptr ; unmarshall_LONG(p,offset) ; unmarshall_LONG(p,len) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p,rcode) ; /* * Data we are looking for is in the current record. */ TRACE(2,"rfio","rfio_preread: record offset is %d and its length is %d",offset,len) ; TRACE(2,"rfio","rfio_preread: We want to go at offset %d",rfilefdt[s_index]->offset) ; if ( (offset <= rfilefdt[s_index]->offset) && (rfilefdt[s_index]->offset < (offset+len)) ) { /* * lseek() or read() returned an error. */ if ( status == -1 ) { rfio_errno= rcode ; END_TRACE() ; return -1 ; } /* * Copying data into user buffer. */ if (rfilefdt[s_index]->offset < (offset+status)) { p+= rfilefdt[s_index]->offset - offset ; ncount= min(size-ngot,status-(rfilefdt[s_index]->offset-offset)) ; TRACE(2, "rfio", "rfio_preread: copy %d cached bytes from 0X%X to 0X%X",ncount,p,buffer+ngot); (void) memcpy(buffer+ngot,p,ncount) ; rfilefdt[s_index]->offset += ncount ; ngot += ncount ; } /* * The current record is reaching the end of file. */ if ( len != status ) { TRACE(2, "rfio", "rfio_preread: len=%d != status=%d, set eof",len,status); rfilefdt[s_index]->eof= 1 ; END_TRACE() ; return ngot ; } /* * The user request is satisfied. */ if ( ngot == size ) { END_TRACE() ; return ngot ; } } /* * Pointing to the next record. */ if ( status == -1 ) { rfilefdt[s_index]->_iobuf.ptr += 4*LONGSIZE ; } else { rfilefdt[s_index]->_iobuf.ptr += 4*LONGSIZE + status ; } rfilefdt[s_index]->nbrecord -- ; /* * No more data in the buffer. */ if ( rfilefdt[s_index]->nbrecord == 0 ) { WORD req ; int msgsiz ; /* * It was the last message. * No more data will be sent. */ if ( rfilefdt[s_index]->preseek == 2 ) break ; /* * Filling the buffer. */ msgsiz= rfilefdt[s_index]->_iobuf.hsize + rfilefdt[s_index]->_iobuf.dsize ; TRACE(2,"rfio","rfio_preread: reading %d bytes",msgsiz) ; if ( netread_timeout(s,rfilefdt[s_index]->_iobuf.base,msgsiz,RFIO_CTRL_TIMEOUT) != msgsiz ) { TRACE(2,"rfio","rfio_preread: read(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } p= rfilefdt[s_index]->_iobuf.base ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p,rcode) ; unmarshall_LONG(p,msgsiz) ; if ( status == -1 ) break ; rfilefdt[s_index]->nbrecord= status ; rfilefdt[s_index]->_iobuf.ptr= iodata(rfilefdt[s_index]) ; rfilefdt[s_index]->preseek= ( req == RQST_LASTSEEK ) ? 2 : 1 ; } } while( rfilefdt[s_index]->preseek ) ; /* * Preseek data did not satisfied the read() request. * rfio_read() will process the request. */ rfilefdt[s_index]->nbrecord= 0 ; rfilefdt[s_index]->preseek= 0 ; END_TRACE() ; return -2 ; } /* * Filling RFIO buffer. */ int rfio_filbuf(s,buffer,size) int s ; char * buffer ; /* Pointer to the buffer. */ int size ; /* How many bytes do we want to read ? */ { int status ; int rcode ; int msgsiz ; WORD req ; char * p ; /* Pointer to buffer */ int nbytes ; /* Number of bytes to read */ int hsize ; /* Message header size */ int firstread= 0 ; /* The request has just been issued. */ char rfio_buf[BUFSIZ]; int s_index; /* Avoiding Valgrind error messages about uninitialized data */ memset(rfio_buf, 0, BUFSIZ); INIT_TRACE("RFIO_TRACE"); TRACE(1,"rfio","rfio_filbuf(0X%X,%d) entered",buffer,size) ; if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) < 0) { TRACE(2,"rfio","rfio_filbuf: rfio_rfilefdt_findentry(): ERROR occured (serrno=%d)", serrno) ; END_TRACE() ; return -1 ; } nbytes = size; hsize= rfilefdt[s_index]->_iobuf.hsize ; /* * If necessary a read request is sent. */ if ( ! rfilefdt[s_index]->readissued ) { firstread= 1 ; p= rfio_buf ; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p,(rfilefdt[s_index]->ahead)?RQST_READAHEAD:RQST_READ) ; marshall_LONG(p,size) ; marshall_LONG(p,rfilefdt[s_index]->lseekhow) ; marshall_LONG(p,rfilefdt[s_index]->lseekoff) ; rfilefdt[s_index]->lseekhow= -1 ; TRACE(2,"rfio","rfio_filbuf: s=%d, s_index=%d, writing %d bytes, lseekoff=%d",s,s_index,RQSTSIZE, rfilefdt[s_index]->lseekoff) ; if (netwrite_timeout(s,rfio_buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2,"rfio","rfio_filbuf: write(): ERROR occured (errno=%d)", errno) ; END_TRACE() ; return -1 ; } if ( rfilefdt[s_index]->ahead ) rfilefdt[s_index]->readissued= 1 ; } /* * Reading data from network. */ do { /* * The buffer is the user buffer. * Only data can be written in it. */ if ( rfilefdt[s_index]->_iobuf.base == NULL ) { TRACE(2, "rfio", "rfio_filbuf: reading %d bytes",hsize) ; if ( netread_timeout(s,rfio_buf,hsize,RFIO_CTRL_TIMEOUT) != hsize ) { TRACE(2,"rfio","rfio_filbuf: read(): ERROR occured (errno=%d)", errno); END_TRACE(); return -1 ; } p= rfio_buf ; unmarshall_WORD(p,req) ; /* RQST_READ, RQST_READAHEAD or RQST_FIRSTREAD */ unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; unmarshall_LONG(p,msgsiz) ; if ( status < 0 ) { rfio_errno= rcode ; if ( rcode == 0 ) serrno = SENORCODE ; END_TRACE() ; return -1 ; } nbytes= msgsiz ; /* Nb of bytes still to read */ p= buffer ; /* Pointer to buffer */ } else { int nread ; int nwant ; int ngot ; for(nread= 0,nwant= size+hsize; nread .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_readlink (const char *" path , .BI "char *" buf , .BI "int " length ) .SH DESCRIPTION .B rfio_readlink gets the content of the symbolic link identified by .IR path . .LP .I buf content is not null terminated. .br Symbolic link content can be truncated to .I length if .I buf is too small. .SH RETURN VALUE This routine returns the count of bytes placed in .I buf if the operation was successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B ENOENT .I path does not exist. .TP .B ENOMEM Insufficient memory. .TP .B EACCES Search permission is denied on a component of the .I path prefix. .TP .B EFAULT .I path or .I buf is a NULL pointer. .TP .B ENOTDIR A component of the .I path prefix is not a directory. .TP .B EINVAL .I path is not a symbolic link or .I length is not positive. .TP .B ENAMETOOLONG The length of .I path exceeds .B CA_MAXPATHLEN or the length of a path component exceeds .BR CA_MAXNAMELEN . .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SECOMERR Communication error. .TP .B SEOPNOTSUP Not supported on Windows. .SH SEE ALSO .BR Castor_limits(4) , .BR rfio_symlink(3) , .BR rfio_unlink(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_access.man0000644000175000017500000000434111356313176016143 0ustar ellertellert.\" .\" $Id: rfio_access.man 3515 2010-04-05 07:51:26Z baud $ .\" .\" @(#)$RCSfile: rfio_access.man,v $ $Revision: 3515 $ $Date: 2010-04-05 09:51:26 +0200 (Mon, 05 Apr 2010) $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2010 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_ACCESS 3 "$Date: 2010-04-05 09:51:26 +0200 (Mon, 05 Apr 2010) $" CASTOR "Rfio Library Functions" .SH NAME rfio_access \- check existence/accessibility of a file/directory .SH SYNOPSIS Under Unix: .br .B #include .br .B #include .br \fB#include "rfio_api.h"\fR .sp Under Windows/NT: .br .B #include .br .B #define R_OK 4 .br .B #define W_OK 2 .br .B #define X_OK 1 .br .B #define F_OK 0 .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_access (const char *" path , .BI "int " amode ); .SH DESCRIPTION .B rfio_access checks the existence or the accessibility of the file/directory .I path according to the bit pattern in .I amode using the real user ID. .TP .I path specifies the logical pathname relative to the current directory or the full pathname. .TP .I amode the bit pattern is built by an OR of the constants defined in .RB < unistd.h > under Unix or to be explicitly defined under Windows/NT: .RS .TP .B R_OK test for read permission .TP .B W_OK test for write permission .TP .B X_OK test for search/execute permission .TP .B F_OK test for existence of the directory/file. .RE .SH RETURN VALUE This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B ENOENT The named file/directory does not exist. .TP .B EACCES Search permission is denied on a component of the .I path prefix or specified access to the file itself is denied. .TP .B EFAULT .I path is a NULL pointer. .TP .B ENOTDIR A component of .I path prefix is not a directory. .TP .B EINVAL .I amode is invalid. .TP .B ENAMETOOLONG The length of .I path exceeds .B CA_MAXPATHLEN or the length of a .I path component exceeds .BR CA_MAXNAMELEN . .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR Castor_limits(4) , .BR rfio_chmod(3) , .B rfio_stat(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_mkdir.man0000644000175000017500000000340110222773541016001 0ustar ellertellert.\" .\" $Id: rfio_mkdir.man,v 1.1 2005/03/31 13:13:03 baud Exp $ .\" .\" @(#)$RCSfile: rfio_mkdir.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2001 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_MKDIR 3 "$Date: 2005/03/31 13:13:03 $" CASTOR "Rfio Library Functions" .SH NAME rfio_mkdir \- create a new directory .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_mkdir (const char *" path ", mode_t " mode ");" .SH DESCRIPTION .B rfio_mkdir creates a new directory. .LP An entry is created and the directory's owner ID is set to the effective user ID of the requestor. The group ID of the directory is set to the effective group ID of the requestor. .TP .I path specifies the logical pathname relative to the current directory or the full pathname. .SH RETURN VALUE This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B ENOENT A component of .I path prefix does not exist or .I path is a null pathname. .TP .B EACCES Search permission is denied on a component of the .I path prefix or write permission on the parent directory is denied. .TP .B EFAULT .I path is a NULL pointer. .TP .B EEXIST .I path exists already. .TP .B ENOTDIR A component of .I path prefix is not a directory. .TP .B ENOSPC No space to store the new directory. .TP .B ENAMETOOLONG The length of .I path exceeds .B CA_MAXPATHLEN or the length of a .I path component exceeds .BR CA_MAXNAMELEN . .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR Castor_limits(4) , .BR rfio_chmod(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_fseeko64.man0000644000175000017500000000021510222773541016321 0ustar ellertellert.so ./rfio_fseek.man .\" @(#)$RCSfile: rfio_fseeko64.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:02 $ CERN IT-PDP/DM Jean-Philippe Baud lcgdm-1.10.0/rfio/close.c0000644000175000017500000001332410225414713014431 0ustar ellertellert/* * $Id: close.c,v 1.3 2005/04/08 05:42:35 baud Exp $ */ /* * Copyright (C) 1990-2005 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: close.c,v $ $Revision: 1.3 $ $Date: 2005/04/08 05:42:35 $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy, F. Hassine"; #endif /* not lint */ /* close.c Remote File I/O - close a file */ #define RFIO_KERNEL 1 #include "Castor_limits.h" #include "rfio.h" #include "rfio_rfilefdt.h" #include /* malloc prototype */ /* * remote file close */ int DLL_DECL rfio_close(s) int s; { char rfio_buf[BUFSIZ]; int s_index; /* Remote file ? */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) != -1) { if (rfilefdt[s_index]->version3 == 1) { /* New V3 stream protocol for sequential transfers */ return(rfio_close_v3(s)); } else return(rfio_close_v2(s)); } else return(rfio_close_v2(s)); } int rfio_close_v2(s) int s; { char rfio_buf[BUFSIZ] ; char * p ; int HsmType, status, status1; struct { unsigned int rcount; /* read() count */ unsigned int wcount; /* write() count */ unsigned int rbcount;/* byte(s) read */ unsigned int wbcount;/* byte(s) written */ } iostatbuf ; char * trp ; /* Pointer to a temporary buffer */ int temp= 0 ; /* A temporary buffer has been allocated */ int s_index; int save_errno; /* Avoiding Valgrind error messages about uninitialized data */ memset(rfio_buf, 0, BUFSIZ); INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_close(%d)", s); /* * Check if file is Hsm. For CASTOR HSM files, the file is * closed using normal RFIO (local or remote) close(). */ HsmType = rfio_HsmIf_GetHsmType(s,NULL); if ( HsmType > 0 && HsmType != RFIO_HSM_CNS ) { status = rfio_HsmIf_close(s); END_TRACE() ; return(status); } /* * The file is local */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1) { char r_token[CA_MAXDPMTOKENLEN+1]; char upath[CA_MAXHOSTNAMELEN+CA_MAXPATHLEN+2]; if ( HsmType == RFIO_HSM_CNS ) status1 = rfio_HsmIf_getipath(s,upath,r_token); TRACE(2, "rfio", "rfio_close: using local close(%d)",s) ; status= close(s) ; if ( status < 0 ) serrno = 0; save_errno = errno; #if defined (CLIENTLOG) /* Client logging */ rfio_logcl(s); #endif if ( HsmType == RFIO_HSM_CNS ) { if ( status1 == 1 ) { status1 = rfio_HsmIf_reqtoput(upath,r_token); if ( status1 == 0 ) errno = save_errno; } } else { status1 = 0; } END_TRACE() ; rfio_errno = 0; return (status ? status : status1) ; } #if defined (CLIENTLOG) /* Client logging */ rfio_logcl(s); #endif /* * Checking magic number */ if ( rfilefdt[s_index]->magic != RFIO_MAGIC ) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(s_index); (void) close(s) ; END_TRACE(); return(-1); } /* * Sending request. */ memset(rfio_buf, 0, BUFSIZ); p= rfio_buf ; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_CLOSE); TRACE(2, "rfio", "rfio_close: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(s, rfio_buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio", "rfio_close: write(): ERROR occured (errno=%d)", errno); (void) rfio_cleanup(s) ; END_TRACE() ; return -1 ; } /* * Getting data from the network. */ for(;;) { WORD req ; LONG rcode ; LONG msgsiz ; TRACE(2, "rfio", "rfio_close: reading %d bytes",rfilefdt[s_index]->_iobuf.hsize) ; if (netread_timeout(s,rfio_buf,rfilefdt[s_index]->_iobuf.hsize,RFIO_DATA_TIMEOUT) != rfilefdt[s_index]->_iobuf.hsize) { TRACE(2, "rfio", "rfio_close: read(): ERROR occured (errno=%d)", errno); if ( temp ) (void) free(trp) ; (void)rfio_cleanup(s) ; END_TRACE() ; return -1 ; } p = rfio_buf ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; unmarshall_LONG(p,msgsiz) ; rfio_errno = rcode ; switch(req) { case RQST_CLOSE: if ( temp ) (void) free(trp) ; status1 = rfio_cleanup(s) ; TRACE(1, "rfio", "rfio_close: return status=%d, rcode=%d",status,rcode) ; END_TRACE() ; return (status ? status : status1) ; case RQST_READAHEAD: case RQST_READAHD64: case RQST_LASTSEEK: case RQST_PRESEEK: case RQST_PRESEEK64: /* * At this point a temporary buffer may need to be created * to receive data which is going to be thrown away. */ if ( temp == 0 ) { if ( rfilefdt[s_index]->_iobuf.base==NULL || rfilefdt[s_index]->_iobuf.dsize #if defined(SOLARIS) #include #include #endif #if defined(_AIX) || defined(__Lynx__) #include #endif #if defined(sgi) || defined( _AIX ) || defined(__Lynx__) #include #endif #if (defined(__osf__) && defined(__alpha)) || defined( __APPLE__) #include #endif #if defined( hpux ) || defined(linux) #include #endif #endif #include int DLL_DECL rfstatfs(path, statfsbuf ) char *path ; struct rfstatfs *statfsbuf ; { int status = 0 ; #if defined(_WIN32) DWORD bps, nfc, spc, tnc; char *p, *rootpath; char pathbuf[256]; #else #if defined( SOLARIS ) static struct statvfs fsbuffer ; #else static struct statfs fsbuffer; #endif #endif #if defined(__osf__) && defined(__alpha) if ( statfs(path,&fsbuffer,(int)sizeof(struct statfs)) < 0) { status = -1; } #endif #if defined( sgi ) if ( statfs(path,&fsbuffer,(int)sizeof(struct statfs),(int)0) < 0) { status = -1; } #endif #if defined( _AIX ) || defined( hpux ) || defined(linux) || defined( __APPLE__) if ( statfs(path,&fsbuffer) < 0 ) { status = -1; } #endif #if defined ( SOLARIS ) if (statvfs ( path, &fsbuffer ) < 0) { status = -1; } #endif #if defined(__Lynx__) if ( statfs(path,&fsbuffer,sizeof(struct statfs),0) < 0 ) { status = -1; } #endif #if defined(_WIN32) if (*(path+1) == ':') { /* drive name */ pathbuf[0] = *path; pathbuf[1] = *(path+1); pathbuf[2] = '\\'; pathbuf[3] = '\0'; rootpath = pathbuf; } else if (*path == '\\' && *(path+1) == '\\') { /* UNC name */ if ((p = strchr (path+2, '\\')) == 0) return (-1); if (p = strchr (p+1, '\\')) strncpy (pathbuf, path, p-path+1); else { strcpy (pathbuf, path); strcat (pathbuf, "\\"); } rootpath = pathbuf; } else rootpath = NULL; if (GetDiskFreeSpace (rootpath, &spc, &bps, &nfc, &tnc) == 0) { status = -1; } #endif /* * Affecting variables */ if ( status == 0 ) { #if defined( sgi ) || defined( __Lynx__ ) statfsbuf->freeblks = (long)fsbuffer.f_bfree; statfsbuf->bsize = (long)fsbuffer.f_bsize ; statfsbuf->totblks = (long)fsbuffer.f_blocks; statfsbuf->totnods = (long)fsbuffer.f_files ; statfsbuf->freenods = (long)fsbuffer.f_ffree ; #endif #if defined(SOLARIS) statfsbuf->freeblks = (long)fsbuffer.f_bavail; statfsbuf->bsize = (long)fsbuffer.f_frsize ; statfsbuf->totblks = (long)fsbuffer.f_blocks; statfsbuf->totnods = (long)fsbuffer.f_files ; statfsbuf->freenods = (long)fsbuffer.f_ffree ; #endif #if defined( hpux ) || defined( _AIX ) || defined(linux) || defined( __APPLE__) statfsbuf->totblks = (long)fsbuffer.f_blocks; statfsbuf->freeblks = (long)fsbuffer.f_bavail; statfsbuf->totnods = (long)fsbuffer.f_files ; statfsbuf->freenods = (long)fsbuffer.f_ffree ; statfsbuf->bsize = (long)fsbuffer.f_bsize; #endif #if defined(__osf__) && defined(__alpha) statfsbuf->totblks = (long)fsbuffer.f_blocks; statfsbuf->freeblks = (long)fsbuffer.f_bavail; statfsbuf->totnods = (long)fsbuffer.f_files ; statfsbuf->freenods = (long)fsbuffer.f_ffree ; statfsbuf->bsize = (long)fsbuffer.f_fsize ; #endif #if defined(_WIN32) statfsbuf->totblks = (long)tnc; statfsbuf->freeblks = (long)nfc; statfsbuf->totnods = (long)-1; statfsbuf->freenods = (long)-1; statfsbuf->bsize = (long)(spc * bps); #endif } return status ; } int DLL_DECL rfstatfs64(path, statfsbuf ) char *path ; struct rfstatfs64 *statfsbuf ; { int status = 0 ; #if defined(_WIN32) DWORD bps, nfc, spc, tnc; char *p, *rootpath; char pathbuf[256]; #else #if defined( SOLARIS ) static struct statvfs64 fsbuffer ; #else #if defined(AIX) || defined(linux) static struct statfs64 fsbuffer; #else static struct statfs fsbuffer; #endif #endif #endif #if defined(__osf__) && defined(__alpha) if ( statfs(path,&fsbuffer,(int)sizeof(struct statfs)) < 0) { status = -1; } #endif #if defined( sgi ) if ( statfs(path,&fsbuffer,(int)sizeof(struct statfs),(int)0) < 0) { status = -1; } #endif #if defined( _AIX ) || defined(linux) if ( statfs64(path,&fsbuffer) < 0 ) { status = -1; } #endif #if defined( hpux ) || defined( __APPLE__) if ( statfs(path,&fsbuffer) < 0 ) { status = -1; } #endif #if defined ( SOLARIS ) if (statvfs64 ( path, &fsbuffer ) < 0) { status = -1; } #endif #if defined(__Lynx__) if ( statfs(path,&fsbuffer,sizeof(struct statfs),0) < 0 ) { status = -1; } #endif #if defined(_WIN32) if (*(path+1) == ':') { /* drive name */ pathbuf[0] = *path; pathbuf[1] = *(path+1); pathbuf[2] = '\\'; pathbuf[3] = '\0'; rootpath = pathbuf; } else if (*path == '\\' && *(path+1) == '\\') { /* UNC name */ if ((p = strchr (path+2, '\\')) == 0) return (-1); if (p = strchr (p+1, '\\')) strncpy (pathbuf, path, p-path+1); else { strcpy (pathbuf, path); strcat (pathbuf, "\\"); } rootpath = pathbuf; } else rootpath = NULL; if (GetDiskFreeSpace (rootpath, &spc, &bps, &nfc, &tnc) == 0) { status = -1; } #endif /* * Affecting variables */ if ( status == 0 ) { #if defined( sgi ) || defined( __Lynx__ ) statfsbuf->freeblks = (signed64)fsbuffer.f_bfree; statfsbuf->bsize = (long)fsbuffer.f_bsize ; statfsbuf->totblks = (signed64)fsbuffer.f_blocks; statfsbuf->totnods = (signed64)fsbuffer.f_files ; statfsbuf->freenods = (signed64)fsbuffer.f_ffree ; #endif #if defined(SOLARIS) statfsbuf->freeblks = (signed64)fsbuffer.f_bavail; statfsbuf->bsize = (long)fsbuffer.f_frsize ; statfsbuf->totblks = (signed64)fsbuffer.f_blocks; statfsbuf->totnods = (signed64)fsbuffer.f_files ; statfsbuf->freenods = (signed64)fsbuffer.f_ffree ; #endif #if defined( hpux ) || defined( _AIX ) || defined(linux) || defined( __APPLE__) statfsbuf->totblks = (signed64)fsbuffer.f_blocks; statfsbuf->freeblks = (signed64)fsbuffer.f_bavail; statfsbuf->totnods = (signed64)fsbuffer.f_files ; statfsbuf->freenods = (signed64)fsbuffer.f_ffree ; statfsbuf->bsize = (long)fsbuffer.f_bsize; #endif #if defined(__osf__) && defined(__alpha) statfsbuf->totblks = (signed64)fsbuffer.f_blocks; statfsbuf->freeblks = (signed64)fsbuffer.f_bavail; statfsbuf->totnods = (signed64)fsbuffer.f_files ; statfsbuf->freenods = (signed64)fsbuffer.f_ffree ; statfsbuf->bsize = (long)fsbuffer.f_fsize ; #endif #if defined(_WIN32) statfsbuf->totblks = (signed64)tnc; statfsbuf->freeblks = (signed64)nfc; statfsbuf->totnods = (signed64)-1; statfsbuf->freenods = (signed64)-1; statfsbuf->bsize = (long)(spc * bps); #endif } return status ; } lcgdm-1.10.0/rfio/rfio_fcalls.c0000644000175000017500000003302712245655020015613 0ustar ellertellert/* * $Id: rfio_fcalls.c 9755 2013-11-28 14:58:24Z dhsmith $ */ /* * Copyright (C) 1994-2010 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rfio_fcalls.c,v $ $Revision: 9755 $ $Date: 2013-11-28 15:58:24 +0100 (Thu, 28 Nov 2013) $ CERN/IT/PDP/DM Felix Hassine" ; #endif /* not lint */ /* rfio_fcalls.c - Remote file I/O - server FORTRAN calls */ #define DEBUG 0 /* Debugging flag */ #define RFIO_KERNEL 1 /* KERNEL part of the programs */ #include #include #include #include #include "rfio.h" /* Remote file I/O */ #include /* Genralized error logger */ #if defined(_WIN32) #include "syslog.h" #else #include /* System parameters */ #endif #include /* * External declarations for error handling * and space allocation. */ extern char *getconfent(); extern int checkkey(); /* To check passwd provided */ /* *External functions for RFIOs */ extern int usf_open(); extern int udf_open(); extern int usf_write(); extern int udf_write(); extern int usf_read(); extern int udf_read(); extern int uf_close(); extern void uf_cread(); #if defined(_WIN32) #if !defined (MAX_THREADS) #define MAX_THREADS 64 #endif /* MAX_THREADS */ #if !defined (RFIO_MAX_PORTS) #define RFIO_MAX_PORTS 10 #endif /* RFIO_MAX_PORTS */ extern /*__declspec( thread ) */ DWORD tls_i; extern struct thData { SOCKET ns; /* control socket */ struct sockaddr_storage from; int fromlen; int mode; int _is_remote; int fd; /* globals, which have to be local for thread... */ char *rqstbuf; /* Request buffer */ char *filename; /* file name */ char *iobuffer; /* Data communication buffer */ int iobufsiz; /* Current io buffer size */ SOCKET data_s; /* Data listen socket (v3) */ SOCKET data_sock; /* Data accept socket (v3) */ SOCKET ctrl_sock; /* the control socket (v3) */ int first_write; int first_read; int byte_read_from_network; struct rfiostat myinfo; char from_host[MAXHOSTNAMELEN]; } *td; #define rqstbuf td->rqstbuf #define filename td->filename #define iobuffer td->iobuffer #define iobufsiz td->iobufsiz #define data_s td->data_s #define data_sock td->data_sock #define ctrl_sock td->ctrl_sock #define first_write td->first_write #define first_read td->first_read #define byte_read_from_network td->byte_read_from_network #define is_remote td->_is_remote #define myinfo td->myinfo #else /* ! _WIN32 */ /* * Data buffer. */ static char * iobuffer ; static int iobufsiz= 0; /* * External declaration of request buffer. * ( Defined in rfio_calls.c ) */ extern char rqstbuf[] ; #endif /* _WIN32 */ extern int switch_open(); extern int switch_close(); extern int switch_write(); extern int switch_read(); extern int srchkreqsize _PROTO((SOCKET, char *, int)); /************************************************************************/ /* */ /* IO HANDLERS */ /* */ /************************************************************************/ int srxyopen(s, rlun,access, rt,host, bet) int s; int *rlun; int *access; int rt; char *host; int bet ; { char *p ; /* Msg buffer pointer */ int len ; /* Msg length */ WORD uid, gid, mask, ftype, format ; /* Open flags */ LONG lun, lrecl, openopt ; /* Open flags */ int append ; /* Open flag */ int trunc; /* Open flag */ char account[MAXACCTSIZE] ; /* client account */ #if !defined(_WIN32) char filename[MAXFILENAMSIZE] ; /* file name */ #endif int filen ; /* file name length */ int status ; /* Status */ char user[CA_MAXUSRNAMELEN+1]; int passwd,mapping; char reqhost[MAXHOSTNAMELEN]; int sock ; *rlun= 0 ; p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p,len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { status = errno; } else { log(LOG_DEBUG,"rxyopen: betel protocol ? %s\n",(bet ? "yes":"no")); /* * Reading xyopen request. */ log(LOG_DEBUG,"rxyopen: reading %d bytes\n",len) ; if ((status = netread_timeout(s,rqstbuf,len,RFIO_CTRL_TIMEOUT)) != len) { log(LOG_ERR,"rxyopen: read(): %s\n",strerror(errno)); return -1 ; } p= rqstbuf ; status = 0; *account = *filename = '\0'; unmarshall_WORD(p, uid); unmarshall_WORD(p, gid); unmarshall_WORD(p, mask); unmarshall_WORD(p, ftype); unmarshall_LONG(p, lun); unmarshall_WORD(p, format); unmarshall_WORD(p, *access); unmarshall_LONG(p, lrecl); unmarshall_LONG(p, openopt); if ( (status == 0) && (status = unmarshall_STRINGN(p, account, MAXACCTSIZE)) == -1 ) status = E2BIG; if ( (status == 0) && (status = unmarshall_STRINGN(p, filename, MAXFILENAMSIZE)) == -1 ) status = SENAMETOOLONG; if (bet) { if ( (status == 0) && (status = unmarshall_STRINGN(p, user, CA_MAXUSRNAMELEN+1)) == -1 ) status = E2BIG; if ( (status == 0) && (status = unmarshall_STRINGN(p, reqhost, MAXHOSTNAMELEN)) == -1 ) status = E2BIG; unmarshall_LONG(p, passwd); unmarshall_WORD(p, mapping); } if (rt) { log(LOG_DEBUG, "Mapping: %s\n", (mapping ? "yes" : "no") ); openlog("rfio",LOG_PID, LOG_USER) ; syslog(LOG_ALERT, "rfio: connection %s mapping by %s(%d,%d) from %s",(mapping ?"with" : "without"),user,uid,gid,host) ; closelog() ; } if (rt && !mapping) { log(LOG_DEBUG, "passwd: %d\n",passwd); log(LOG_DEBUG, "reqhost: %s\n",reqhost); } /* * Someone in the site has tried to specify (uid,gid) directly ! */ if (bet && !mapping && !rt) { log(LOG_INFO,"attempt to make non-mapped I/O and modify uid or gid !\n"); status=EACCES ; } if ( bet ) log(LOG_DEBUG,"Opening file %s for remote user: %s\n",filename,user); /* * Do not authorize any request to create file to * a user whose uid < 100 */ if ( uid < 100 ) { log(LOG_INFO,"attempt to start rfiod with (uid,gid)=(%d,%d) rejected\n",uid,gid); status=EACCES; } /* * MAPPED mode: user will be mapped to user "to" */ if ( !status && rt && mapping ) { char to[100]; int rcd,to_uid,to_gid ; if ( (rcd = get_user(host,user,uid,gid,to,&to_uid,&to_gid)) == -ENOENT ) { log(LOG_ERR,"get_user(): Error opening mapping file\n") ; status=EINVAL ; } if ( abs(rcd) == 1 ) { log(LOG_ERR,"No entry found in mapping file for (%s,%s,%d,%d)\n", host,user,uid,gid); status = EACCES; } else { log(LOG_DEBUG,"(%s,%s,%d,%d) mapped to %s(%d,%d)\n", host,user,uid,gid,to,to_uid,to_gid) ; uid = to_uid ; gid = to_gid ; } } /* * DIRECT access: the user specifies uid & gid by himself */ if ( !status && rt && !mapping ) { char *pr ; if ( (pr= getconfent ("RTUSER","CHECK",0)) == NULL || !strcmp ( pr,"YES") ) { log(LOG_INFO ,"Connecting %s for passwd check ...\n",reqhost); if ((sock=connecttpread(reqhost,passwd))>=0 && !checkkey(sock,passwd)) { status= EACCES; log(LOG_ERR,"ropen: DIRECT mapping : permission denied\n"); } if (sock < 0) { status= EACCES ; log(LOG_ERR,"ropen: DIRECT mapping failed: Couldn't connect %s\n",reqhost); } } else log(LOG_INFO ,"Any DIRECT rfio request from out of site is authorized\n"); } if ( !status ) { filen= strlen(filename) ; log(LOG_DEBUG, "rxyopen: uid %d gid %d mask %o ftype %d \n",uid, gid, mask, ftype); log(LOG_DEBUG, "rxyopen: lun %d format %d access %d lrecl %d openopt %x\n", lun, format, *access, lrecl, openopt); log(LOG_DEBUG, "rxyopen: account: %s\n", account); log(LOG_DEBUG, "rxyopen: filename: %s\n", filename); log(LOG_INFO, "rxyopen(%s) for (%d,%d)\n",filename,uid,gid); *rlun = lun; (void) umask(mask); append = openopt & FFOOPT_A; trunc = openopt & FFOOPT_T; #if !defined(_WIN32) (void) setgroups(0, NULL); if (gid == -1 || uid == -1) { status = EACCES; log(LOG_ERR,"rxyopen: denied\n"); } else if ((setgid(gid)<0) || (setuid(uid)<0)) { status = errno; log(LOG_ERR, "rxyopen: unable to setuid,gid(%d,%d): %s\n", uid, gid, strerror(errno)); } else #endif { status=switch_open(access, &lun, filename, &filen, &lrecl, (LONG *)&append,(LONG *)&trunc,LLTM); log(LOG_DEBUG, "rxyopen: %d\n", status); } } } p= rqstbuf; marshall_LONG(p, status); log(LOG_DEBUG, "rxyopen: sending back %d\n", status); if (netwrite_timeout(s, rqstbuf, LONGSIZE, RFIO_CTRL_TIMEOUT) != LONGSIZE) { log(LOG_ERR, "rxyopen: write(): %s\n", strerror(errno)); return(-1); } log(LOG_INFO, "rxyopen(%s): status is: %d\n",filename,status); return(status); } int srxyclos(s, infop, lun) int s; int lun; struct rfiostat * infop ; { int status=0; char *p ; int irc; log(LOG_INFO, "%d read, %d readahead, %d write, %d flush, %d stat, %d lseek and %d preseek\n", infop->readop,infop->aheadop,infop->writop,infop->flusop,infop->statop,infop->seekop,infop->presop); log(LOG_INFO, "%d bytes read and %d bytes written\n",infop->rnbr,infop->wnbr) ; log(LOG_DEBUG, "rxyclos(%d)\n",lun); irc=switch_close(&lun); if (iobufsiz > 0) { log(LOG_DEBUG, "rxyclos(): freeing %x\n",iobuffer); (void) free(iobuffer); } iobufsiz= 0; if (irc != 0){ status = serrno ? serrno : errno; } p= rqstbuf ; marshall_LONG(p,status) ; if (netwrite_timeout(s,rqstbuf,LONGSIZE,RFIO_CTRL_TIMEOUT) != LONGSIZE) { log(LOG_ERR, "rxyclos: write(): %s\n", strerror(errno)); return(-1); } log(LOG_INFO, "rxyclos(%d): status is: %d\n",lun,status); return(status); } int srxywrit(s, infop, lun, access) int s, lun, access ; struct rfiostat * infop ; { int status=0, rcode=0; char *ptr; char *p ; int optval; int nrec, nwrit; p = rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p, nrec); unmarshall_LONG(p, nwrit); log(LOG_DEBUG, "rxywrit(%d,%d): nrec %d nwrit %d\n",s,lun,nrec,nwrit) ; if (iobufsiz < nwrit) { if (iobufsiz > 0) { log(LOG_DEBUG, "rxywrit(): freeing %x\n",iobuffer); (void) free(iobuffer); } if ((iobuffer = malloc(nwrit)) == NULL) { log(LOG_ERR, "rxywrit: malloc(): %s\n", strerror(errno)); return(-1); } iobufsiz = nwrit; log(LOG_DEBUG, "rxywrit(): allocated %d bytes at %x\n",nwrit,iobuffer); optval = iobufsiz; if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&optval, sizeof(optval)) == -1) { log(LOG_ERR, "rxywrit(): setsockopt(SO_RCVBUF): %s\n",strerror(errno)); } log(LOG_DEBUG, "rxywrit(): setsockopt(SO_RCVBUF): %d\n",nwrit); } ptr = iobuffer; if (netread_timeout(s, ptr, nwrit, RFIO_DATA_TIMEOUT) != nwrit) { log(LOG_ERR, "rxywrit: read(): %s\n", strerror(errno)); return(-1); } status=switch_write(access,&lun,ptr,&nwrit,&nrec,LLTM); if (status != 0) { rcode = errno; } else { infop->wnbr+= nwrit ; } log(LOG_DEBUG, "rxywrit: status %d, rcode %d\n", status, rcode); p = rqstbuf; marshall_LONG(p, status); marshall_LONG(p, rcode); if (netwrite_timeout(s, rqstbuf, 2*LONGSIZE, RFIO_CTRL_TIMEOUT) != 2*LONGSIZE) { log(LOG_ERR, "rxywrit: write(): %s\n", strerror(errno)); return(-1); } return(status); } int srxyread(s, infop, lun, access) int s, lun; struct rfiostat * infop ; { int status=0, rcode=0; char *ptr; char *p ; int optval; int nrec, nwant, ngot; int readopt; p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p, readopt); unmarshall_LONG(p, nrec); unmarshall_LONG(p, nwant); log(LOG_DEBUG, "rxyread(%d,%d): readopt %x nrec %d nwant %d\n",s,lun,readopt,nrec,nwant) ; if (iobufsiz < nwant ) { if (iobufsiz > 0) { log(LOG_DEBUG, "rxyread(): freeing %x\n",iobuffer); (void) free(iobuffer); } if ((iobuffer = malloc(nwant)) == NULL) { log(LOG_ERR, "rxyread: malloc(): %s\n", strerror(errno)); return(-1); } iobufsiz = nwant ; log(LOG_DEBUG, "rxyread(): allocated %d bytes at %x\n",nwant,iobuffer); optval = iobufsiz; if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&optval, sizeof(optval)) == -1) { log(LOG_ERR, "rxyread(): setsockopt(SO_SNDBUF): %s\n",strerror(errno)); } log(LOG_DEBUG, "rxyread(): setsockopt(SO_SNDBUF): %d\n",nwant); } ptr = iobuffer; serrno = 0 ; status = switch_read(access, &lun, ptr, &nwant, &nrec, readopt, &ngot,LLTM); if (status != 0){ rcode = serrno ? serrno : errno; } else { infop->rnbr+= ngot ; } p = rqstbuf; marshall_LONG(p, status); marshall_LONG(p, rcode); marshall_LONG(p, ngot); if (netwrite_timeout(s, rqstbuf, 3*LONGSIZE, RFIO_CTRL_TIMEOUT) != (3*LONGSIZE)) { log(LOG_ERR, "rxyread: write(): %s\n", strerror(errno)); return(-1); } if ( ngot ) { if (netwrite_timeout(s, ptr, ngot, RFIO_DATA_TIMEOUT) != ngot) { log(LOG_ERR, "rxyread: read(): %s\n", strerror(errno)); return(-1); } } log(LOG_DEBUG, "rxyread: status %d, rcode %d\n", status, rcode); return status ; } lcgdm-1.10.0/rfio/rfdir.c0000644000175000017500000002070711332757053014444 0ustar ellertellert/* * $Id: rfdir.c 3154 2010-02-05 09:00:27Z baud $ */ /* * Copyright (C) 1998-2009 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rfdir.c,v $ $Revision: 3154 $ $Date: 2010-02-05 10:00:27 +0100 (Fri, 05 Feb 2010) $ CERN/IT/PDP/DM Olof Barring"; #endif /* not lint */ /* * List remote directory or file. Gives an ls -al type output */ #define RFIO_KERNEL 1 #include #include #include #include #include #include #include #if !defined(_WIN32) #include #endif #include #include #include #include #define SIXMONTHS (6*30*24*60*60) #ifndef PATH_MAX #include #define PATH_MAX CA_MAXPATHLEN + 1 /* == 1024 == PATH_MAX on IRIX */ #endif time_t current_time; char ftype[8]; int ftype_v[7]; char fmode[10]; int fmode_v[9]; struct dirstack { char *dir; struct dirstack *prev; }; static int exit_rc = 0; static char *ckpath(); char *getconfent(); int main(argc, argv) int argc; char *argv[]; { extern char * optarg; extern int optind; struct stat64 st; char *dir; int rc,i; struct dirent *de; char *filename; char *host; int is_cns_path; char modestr[11]; char owner[20]; char t_creat[14]; struct passwd *pw; struct group *grp; struct tm *t_tm; char uidstr[30]; char gidstr[30]; char path[PATH_MAX]; int recursively = 0; int multiple = 0; char tmpbuf[21]; #if defined(_WIN32) WSADATA wsadata; #endif strcpy(ftype,"pcdb-ls"); ftype_v[0] = S_IFIFO; ftype_v[1] = S_IFCHR; ftype_v[2] = S_IFDIR; ftype_v[3] = S_IFBLK; ftype_v[4] = S_IFREG; ftype_v[5] = S_IFLNK; ftype_v[6] = S_IFSOCK; strcpy(fmode,"rwxrwxrwx"); fmode_v[0] = S_IRUSR; fmode_v[1] = S_IWUSR; fmode_v[2] = S_IXUSR; fmode_v[3] = S_IRGRP; fmode_v[4] = S_IWGRP; fmode_v[5] = S_IXGRP; fmode_v[6] = S_IROTH; fmode_v[7] = S_IWOTH; fmode_v[8] = S_IXOTH; if ( argc < 2 ) { fprintf(stderr,"Usage: %s [-R] [file | directory ...]\n",argv[0]); exit(1); } while ( (i = getopt(argc,argv,"Rr")) != EOF ) { switch(i) { case 'R' : case 'r' : recursively++; break; case '?' : fprintf(stderr,"Usage: %s [-R] [file | directory ...]\n",argv[0]); exit(2); } } (void) time (¤t_time); #if defined(_WIN32) if (WSAStartup (MAKEWORD (2, 0), &wsadata)) { fprintf (stderr, "WSAStartup unsuccessful\n"); exit (2); } #endif multiple = argc - optind - 1; for (;optindpw_name); grp = getgrgid(st.st_gid); if ( grp == NULL ) sprintf(gidstr,"%d",st.st_gid); else strcpy(gidstr,grp->gr_name); } t_tm = localtime(&st.st_mtime); if (st.st_mtime < current_time - SIXMONTHS || st.st_mtime > current_time + 60) strftime(t_creat,13,"%b %d %Y",t_tm); else strftime(t_creat,13,"%b %d %H:%M",t_tm); fprintf(stdout,"%s %3d %-8.8s %-8.8s %s %s %s\n", modestr,st.st_nlink, uidstr,gidstr,u64tostr((u_signed64)st.st_size,tmpbuf,20),t_creat,dir); } else { list_dir(dir,recursively,multiple); } } rfio_end(); exit(exit_rc); } static char *ckpath(path) char *path; { char *cp; static char newpath[BUFSIZ]; /* Special treatment for filenames starting with /scratch/... */ if (!strncmp ("/scratch/", path, 9) && (cp = getconfent ("SHIFT", "SCRATCH", 0)) != NULL) { strcpy (newpath, cp); strcat (newpath, path+9); } else strcpy(newpath,path); return(newpath); } static int rfio_pushdir(ds,dir) struct dirstack **ds; char *dir; { struct dirstack *tmp; if ( ds == NULL || dir == NULL ) return(0); tmp = (struct dirstack *)malloc(sizeof(struct dirstack)); tmp->prev = *ds; tmp->dir = (char *)malloc((strlen(dir)+1)*sizeof(char)); strcpy(tmp->dir,dir); *ds = tmp; return(0); } static struct dirstack *rfio_popdir(ds) struct dirstack **ds; { struct dirstack *tmp; if ( ds == NULL ) return(NULL); tmp = *ds; *ds = (*ds)->prev; free(tmp->dir); free(tmp); return(*ds); } int list_dir(dir,recursively,multiple) char *dir; int recursively,multiple; { RDIR *dirp; struct stat64 st; int rc,i,fd; struct dirent *de; char modestr[11]; char owner[20]; char t_creat[14]; struct passwd *pw; struct group *grp; struct tm *t_tm; char uidstr[30]; char gidstr[30]; char path[PATH_MAX]; uid_t old_uid = -1; gid_t old_gid = -1; struct dirstack *ds = NULL; char *host,*filename; int reqtype = 0; int localdir = 0; int rootpathlen=0; char tmpbuf[21]; int parserc; rc = -1; if ((parserc = rfio_parseln(dir,&host,&filename,RDLINKS))) { if (parserc < 0) { fprintf(stderr,"%s\n",sstrerror(serrno)); exit_rc = 2; return(1); } fd=rfio_connect(host,&i) ; reqtype = RQST_MSTAT64; if ( fd >= 0 ) rc = rfio_smstat64(fd,filename,&st,reqtype); if (fd >= 0) netclose(fd); } else { localdir = 1; } if ( recursively || multiple ) fprintf(stdout,"\n%s:\n\n",dir); dirp = rfio_opendir(dir); if ( dirp == NULL ) { fprintf(stderr, "opendir(): %s: %s\n", dir, rfio_serror()); exit_rc = 2; return(1); } if ( !localdir ) { strcpy(path,host); strcat(path,":"); strcat(path,filename); } else strcpy(path,dir); rootpathlen = strlen(path); path[rootpathlen] = '/'; while ( ( de = rfio_readdir(dirp) ) != NULL ) { rc = 0; path[rootpathlen+1] = '\0'; strcat(path,de->d_name); if (!(parserc = rfio_parseln(path,&host,&filename,RDLINKS)) && host == NULL ) { /* The file is local */ rc = stat64(filename,&st) ; } else { if (parserc < 0) { fprintf(stderr,"%s\n",sstrerror(serrno)); exit_rc = 2; return(1); } if ( localdir ) rc = rfio_stat64(path,&st); else rc = rfio_smstat64(dirp->s,filename,&st,reqtype); } if ( rc ) { fprintf(stderr,"%s: %s\n",path,rfio_serror()); exit_rc = 2; continue; } strcpy(modestr,"----------"); for (i=0; i<6; i++) if ( ftype_v[i] == ( S_IFMT & st.st_mode ) ) break; modestr[0] = ftype[i]; for (i=0; i<9; i++) if (fmode_v[i] & st.st_mode) modestr[i+1] = fmode[i]; if ( S_ISUID & st.st_mode ) modestr[3] = 's'; if ( S_ISGID & st.st_mode ) modestr[6] = 's'; if ( st.st_uid != old_uid) { #ifdef VIRTUAL_ID if ( parserc == 0 && host ) /* cns file */ sprintf(uidstr,"%d",st.st_uid); else { #else { #endif pw = getpwuid(st.st_uid); if ( pw == NULL ) sprintf(uidstr,"%d",st.st_uid); else strcpy(uidstr,pw->pw_name); } old_uid = st.st_uid; } if ( st.st_gid != old_gid ) { #ifdef VIRTUAL_ID if ( parserc == 0 && host ) /* cns file */ sprintf(gidstr,"%d",st.st_gid); else { #else { #endif grp = getgrgid(st.st_gid); if ( grp == NULL ) sprintf(gidstr,"%d",st.st_gid); else strcpy(gidstr,grp->gr_name); } old_gid = st.st_gid; } t_tm = localtime(&st.st_mtime); if (st.st_mtime < current_time - SIXMONTHS || st.st_mtime > current_time + 60) strftime(t_creat,13,"%b %d %Y",t_tm); else strftime(t_creat,13,"%b %d %H:%M",t_tm); fprintf(stdout,"%s %3d %-8.8s %-8.8s %s %s %s\n", modestr,st.st_nlink, uidstr,gidstr,u64tostr((u_signed64)st.st_size,tmpbuf,20),t_creat,de->d_name); if ( strcmp(de->d_name,".") && strcmp(de->d_name,"..") && S_ISDIR(st.st_mode) && recursively ) rfio_pushdir(&ds,path); } rfio_closedir(dirp); while ( ds != NULL ) { list_dir(ds->dir,recursively,multiple); rfio_popdir(&ds); } return(0); } lcgdm-1.10.0/rfio/fileno.c0000644000175000017500000000205410222773541014602 0ustar ellertellert/* * $Id: fileno.c,v 1.1 2005/03/31 13:13:00 baud Exp $ */ /* * Copyright (C) 2002 by CERN/IT/DS/HSM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: fileno.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:00 $ CERN/IT/DS/HSM Jean-Philippe Baud"; #endif /* not lint */ /* fileno.c Remote File I/O - map stream pointer to file descriptor */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rfilefdt.h" int DLL_DECL rfio_fileno(fp) RFILE *fp; /* Remote file pointer */ { int fd; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_fileno(%x)", fp); if ( fp == NULL ) { errno = EBADF; END_TRACE(); return -1 ; } /* * Is the file local? this is the only way to detect it ! */ if (rfio_rfilefdt_findptr(fp,FINDRFILE_WITH_SCAN) == -1) fd = fileno((FILE *)fp); /* The file is local */ else fd = fp->s; /* The file is remote */ END_TRACE() ; return (fd) ; } lcgdm-1.10.0/rfio/rfio_rmdir.man0000644000175000017500000000352610222773541016020 0ustar ellertellert.\" .\" $Id: rfio_rmdir.man,v 1.1 2005/03/31 13:13:03 baud Exp $ .\" .\" @(#)$RCSfile: rfio_rmdir.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2001 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_RMDIR 3 "$Date: 2005/03/31 13:13:03 $" CASTOR "Rfio Library Functions" .SH NAME rfio_rmdir \- remove a directory .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_rmdir (const char *" path ");" .SH DESCRIPTION .B rfio_rmdir removes a directory if it is empty. .TP .I path specifies the logical pathname relative to the current directory or the full pathname. .SH RETURN VALUE This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B ENOENT The named directory does not exist or is a null pathname. .TP .B EACCES Search permission is denied on a component of the .IR path prefix or write permission is denied on the parent directory or the parent has the sticky bit S_ISVTX set and .RS 1.5i .LP the effective user ID of the requestor does not match the owner ID of the directory and .LP the effective user ID of the requestor does not match the owner ID of the parent directory and .LP the requestor is not super-user. .RE .TP .B EFAULT .I path is a NULL pointer. .TP .B EEXIST The named directory is not empty. .TP .B ENOTDIR A component of .I path prefix is not a directory. .TP .B EINVAL .I path is the current directory. .TP .B ENAMETOOLONG The length of .I path exceeds .B CA_MAXPATHLEN or the length of a .I path component exceeds .BR CA_MAXNAMELEN . .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR Castor_limits(4) , .BR rfio_mkdir(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_fwrite.man0000644000175000017500000000252610222773541016202 0ustar ellertellert.\" .\" $Id: rfio_fwrite.man,v 1.1 2005/03/31 13:13:02 baud Exp $ .\" .\" @(#)$RCSfile: rfio_fwrite.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:02 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2001 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_FWRITE 3 "$Date: 2005/03/31 13:13:02 $" CASTOR "Rfio Library Functions" .SH NAME rfio_fwrite \- writes to a file .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_fwrite (const void *" ptr ", int " size ", int " items ", FILE *" fd ");" .SH DESCRIPTION .B rfio_fwrite stores in a file the bytes starting at .BI ptr , a pointer to the memory location in which resides the information, .BI items times .BI size bytes, using the descriptor .BI fd generated by a previous .BR rfio_fopen . .SH RETURN VALUE This routine returns -1 if the operation failed or the number of items actually writen. In case of failure, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EBADF .I fd is a NULL pointer. .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SETIMEDOUT Timed out. .TP .B SEBADVERSION Version ID mismatch. .TP .B SECONNDROP Connection closed by remote end. .TP .B SECOMERR Communication error. .TP .B SENORCODE Host did not return error number. .SH SEE ALSO .BR rfio_fopen(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/logging.c0000644000175000017500000003350110222773541014755 0ustar ellertellert/* * $Id: logging.c,v 1.1 2005/03/31 13:13:00 baud Exp $ */ /* * Copyright (C) 1993-1999 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: logging.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:00 $ CERN/IT/PDP/DM Fabien Collin" ; #endif /* not lint */ /* logging.c : A facility for logging client I/O primitives The logging filename is defined by RFIO/CLIENTLOG in shift.conf If this variable is not defined, no client logging is done To dump a client log, use dump_log */ #include "Castor_limits.h" #include #include #include #include #include #include #include #include #include #include #include "logging.h" #include typedef struct { /* One opened file */ OPEN_BUFFER rec_open; char filename[CA_MAXPATHLEN+1]; ERROR_BUFFER rec_error; RECORD_BUFFER rec_record; int record_table[MAX_RECORD_TABLE]; OPERATION *rec_op; int cur_op; int last_op; time_t session_start_real_time; time_t session_end_real_time; clock_t session_start_user_time; clock_t session_start_sys_time; clock_t session_end_user_time; clock_t session_end_sys_time; } OPENFILE; #define UNUSED 99999 static int client_logging = FALSE ; /* True if client logging is enabled */ static int lf; /* File handle for logging file */ static int panic = FALSE; /* Something wrong, stop logging */ static long incarnation_date; /* A unique number (48 bits) to identify an application */ static short incarnation_pid; static int start = TRUE; /* Code executed only once in an application */ static OPENFILE *file_table = NULL; /* The file table */ static int length_file_table = 0; /* Its size */ static int *fd_table = NULL; /* The fd table : fd_table[index in file table] = file fd */ /* Same size as file_table */ char *getconfent(); void logging_panic(err) int err; { panic = TRUE; switch(err) { case SYSLOG_OVERFLOW: syslog(LOG_ALERT, "rfio: client logging stopped : record table overflow"); break; case SYSLOG_OPEN: syslog(LOG_ALERT, "rfio: client logging stopped : open error"); break; case SYSLOG_WRONG_FD: syslog(LOG_ALERT, "rfio: client logging stopped : wrong fd"); break; case SYSLOG_WRITE: syslog(LOG_ALERT, "rfio: client logging stopped : write error"); break; case SYSLOG_CLOSE: syslog(LOG_ALERT, "rfio: client logging stopped : close error"); break; case SYSLOG_MALLOC: syslog(LOG_ALERT, "rfio: client logging stopped : malloc error"); break; } } /* Open and create (if necessary) the logging file See RFIO/CLIENTLOG variable in shift.conf */ static int open_logfile() { int fd; static char *log_filename; INIT_TRACE("rfio"); log_filename = getconfent("RFIO","CLIENTLOG",0); if ((fd = open(log_filename,O_WRONLY|O_APPEND|O_CREAT,0666)) == -1) { TRACE(1,"log","Can't open file %s",log_filename); END_TRACE() ; return(-1); } else { TRACE(1,"log", "file opened (fd=%d)",fd); fchmod(fd,0666); END_TRACE() ; return(fd); } } /* Find a record size in a record table Returns -1 if size not found Returns the index of the record size if found */ static int find_size(rt,l,size) int size; int rt[],l; { int i; if (l >= MAX_RECORD_TABLE) { logging_panic(SYSLOG_OVERFLOW); return(-1); } if (l == 0) return(-1); else { for (i=0;i= MAX_RECORD_TABLE) { file_table[f].rec_error.num |= ERR_RECORD_FULL; return(-1); } else { file_table[f].record_table[l] = size; return(file_table[f].rec_record.length++); } } /* Find a file table index given its file descriptor */ static int find_fd(fd) int fd; { int i; for (i=0;i int rfio_chkserv (host) char *host ; { int rcode , rt; char *p ; rcode=RFIO_NONET ; rfiosetopt(RFIO_NETOPT, &rcode , 4); rcode = rfio_connect (host,&rt); if (rcode <0 ) return rcode ; p = rfio_buf ; marshall_WORD(p, RFIO_MAGIC ); marshall_WORD(p, RQST_CHKCON ) ; if (netwrite_timeout(rcode, rfio_buf, RQSTSIZE, RFIO_CTRL_TIMEOUT)!= RQSTSIZE ) { INIT_TRACE("RFIO_TRACE"); TRACE(2,"rfio","rfio_chkserv() : write() : ERROR occured (errno=%d)", errno) ; END_TRACE() ; return -1 ; } if ( netread_timeout( rcode , rfio_buf, LONGSIZE, RFIO_CTRL_TIMEOUT) != LONGSIZE ) { INIT_TRACE("RFIO_TRACE"); TRACE(2,"rfio","rfio_chkserv() : read() : ERROR occured (errno=%d)", errno) ; END_TRACE() ; return -1 ; } (void) close(rcode) ; return 0 ; } lcgdm-1.10.0/rfio/fopen64.c0000644000175000017500000000274010222773541014611 0ustar ellertellert/* * $Id: fopen64.c,v 1.1 2005/03/31 13:13:00 baud Exp $ */ /* * Copyright (C) 1990-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: fopen64.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:00 $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy"; #endif /* not lint */ /* fopen64.c Remote File I/O - open a binary file */ /* * System remote file I/O */ #define RFIO_KERNEL 1 #include #include "rfio.h" #include "rfio_rfilefdt.h" /* * Remote file open */ RFILE DLL_DECL *rfio_fopen64(file, mode) char * file ; char * mode ; { register int f, rw, oflags ; int f_index; INIT_TRACE("RFIO_TRACE") ; TRACE(1, "rfio", "rfio_fopen64(%s, %s)", file, mode) ; if (mode[1] == 'b') rw= ( mode[2] == '+' ) ; else rw= ( mode[1] == '+' ) ; switch(*mode) { case 'a': oflags= O_APPEND | O_CREAT | ( rw ? O_RDWR : O_WRONLY ) ; break ; case 'r': oflags= rw ? O_RDWR : O_RDONLY ; break ; case 'w': oflags= O_TRUNC | O_CREAT | ( rw ? O_RDWR : O_WRONLY ) ; break ; default: END_TRACE() ; return NULL ; } f= rfio_open64(file,oflags, 0666) ; if ( f < 0 ) { END_TRACE() ; return NULL ; } if ( (f_index = rfio_rfilefdt_findentry(f,FINDRFILE_WITHOUT_SCAN)) != -1 ) { END_TRACE() ; return (RFILE *) rfilefdt[f_index] ; } else { TRACE(3,"rfio","rfio_fopen64() : Using local FILE ptr "); END_TRACE() ; rfio_errno = 0; return (RFILE *) fdopen(f,mode); } } lcgdm-1.10.0/rfio/rfrm.man0000644000175000017500000000254110366370344014631 0ustar ellertellert.\" .\" $Id: rfrm.man,v 1.2 2006/01/27 10:07:32 baud Exp $ .\" .\" @(#)rfrm.man 1.1 09/07/98 CERN IT-PDP/DM Olof Barring .\" Copyright (C) 1998-2006 by CERN/IT/PDP .\" All rights reserved .\" .TH RFRM 1 "$Date: 2006/01/27 10:07:32 $" .SH NAME rfrm \- remove remote files and directories .SH SYNOPSIS .B rfrm .IR filename... .br .B rfrm [ .BI -f ] [ .BI -r ] .IR directory... .SH DESCRIPTION .IX "\fLrfrm\fR" .B rfrm provides an interface to the .B shift remote file I/O daemon (rfiod) for removing entries for one or more files from a directory. .LP If .IR filename is a symbolic link, the link will be removed, but the file or directory to which it refers will not be deleted. .LP The .IR filename or .IR directory argument is either a remote path name of the form: .IP .IB hostname : path .LP or a local path name (not containing the :/ character combination). .SH "OPTIONS" The following options apply to .B rfrm: .TP .BI \-f Never prompts. .TP .BI \-r Recursively remove directories and subdirectories in the argument list. The directory will be emptied of files and removed. .SH "SEE ALSO" .BR rm(1), .BR rfiod(l) .SH "NOTES" Although .B rfrm supports a list of file names or directories it does not support regular expressions .BR (regexp(5)). For instance, .IP .BR "rfrm host:/a/b/c\e\(**" .LP will not work. .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_fflush.man0000644000175000017500000000171310222773541016166 0ustar ellertellert.\" .\" $Id: rfio_fflush.man,v 1.1 2005/03/31 13:13:02 baud Exp $ .\" .\" @(#)$RCSfile: rfio_fflush.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:02 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2001 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_FFLUSH 3 "$Date: 2005/03/31 13:13:02 $" CASTOR "Rfio Library Functions" .SH NAME rfio_fflush \- flush a file .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_fflush (FILE *" fp ");" .SH DESCRIPTION .B rfio_fflush forces a write of all buffered data for the file whose descriptor \fBfp\fP is the one returned by .B rfio_fopen. The file remains open. .SH RETURN VALUE This routine returns 0 if successful, -1 if the operation failed and .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EBADF .I fp is not a valid file descriptor. .TP .B SEBADVERSION Version ID mismatch. .SH SEE ALSO .BR rfio_fopen(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/connect.c0000644000175000017500000003467211131075303014761 0ustar ellertellert/* * $Id: connect.c,v 1.11 2009/01/07 09:49:55 dhsmith Exp $ */ /* * Copyright (C) 1990-2008 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: connect.c,v $ $Revision: 1.11 $ $Date: 2009/01/07 09:49:55 $ CERN/IT/PDP/DM Frederic Hemmer"; #endif /* not lint */ /* connect.c Remote File I/O - connect to remote server */ #define RFIO_KERNEL 1 /* system part of Remote File I/O */ #if defined(_WIN32) #include "log.h" /* system logger */ #else #include /* system logger */ #endif #include "rfio.h" /* remote file I/O definitions */ #include /* thread local storage for global variables */ #include /* thread-safe network database routines */ #include #ifdef CSEC #include "Csec_api.h" #endif #ifndef _WIN32 #if defined(_REENTRANT) || defined(_THREAD_SAFE) #define strtok(X,Y) strtok_r(X,Y,&last) #endif /* _REENTRANT || _THREAD_SAFE */ #endif /* _WIN32 */ extern char *getconfent(); extern char *getenv(); /* get environmental variable value */ char *rfio_lasthost _PROTO(()); /* returns last succesfully connected host */ int rfio_newhost _PROTO((char *)); /* returns last succesfully connected host */ extern int DLL_DECL isremote_sa _PROTO((struct sockaddr *, char *)); static int last_host_key = -1; /* key to hold the last connect host name in TLS */ int DLL_DECL rfio_connect(node,remote) /* Connect 's rfio server */ char *node; /* remote host to connect */ int *remote ; /* connected host is remote or not */ { register int s; /* socket descriptor */ struct addrinfo hints, *ai, *aitop; /* input and output from getaddrinfo call */ char strport[NI_MAXSERV]; /* string representation of port to connect to */ int gaierrno; /* return code from getaddrinfo */ struct in6_addr test6_addr; /* used for checking for port number */ struct sockaddr_storage sin; /* keep address of connected server */ int isconnected, last_error; /* record error and connection status */ #if defined(_WIN32) int last_wsa_error; /* record error during connection */ #endif char *host; /* host name chararcter string */ char *p, *cp; /* character string pointers */ register int retrycnt; /* number of NOMORERFIO retries */ register int retryint; /* interval between NOMORERFIO retries */ register int crtycnt = 0; /* connect retry count */ register int crtyint = 0; /* connect retry interval */ register int crtyattmpt = 0; /* connect retry attempts done */ register int crtycnts = 0 ; struct stat statbuf ; /* NOMORERFIO stat buffer */ char nomorebuf1[BUFSIZ], nomorebuf2[BUFSIZ]; /* NOMORERFIO buffers */ char *last_host = NULL; int last_host_len = 256; #ifndef _WIN32 #if defined(_REENTRANT) || defined(_THREAD_SAFE) char *last = NULL; #endif #endif int port = -1; int timeout; #ifdef CSEC Csec_context_t ctx; struct rfio_api_thread_info *thip = NULL; #endif char tmphost[CA_MAXHOSTNAMELEN+1]; INIT_TRACE("RFIO_TRACE"); /* make local copy of "node" string */ p = NULL; if (strlen(node)>=sizeof(tmphost)) { TRACE(1,"rfio","host name too long"); serrno = SENOSHOST; END_TRACE(); return(-1); } strcpy(tmphost, node); node = tmphost; /* Check if a port number is present and remove if found * the host portion may be a hostname of IP address of the form * IPv4 [IPv4] [IPv6] * or IPv6 if there is no port number */ if ((p = strrchr (node, ':'))) { char *p2; p2 = strchr (node, ':'); if (p2 != p && !memchr (p2+1, ']', p-p2-1)) { p = NULL; } } if (p) { *p = '\0'; port = atoi (p+1); } /* * Should we use an alternate name ? */ /* * Under some circumstances (heavy load, use of inetd) the server fails * to accept a connection. A simple retry mechanism is therefore * implemented here. */ if ( rfioreadopt(RFIO_NETRETRYOPT) != RFIO_NOTIME2RETRY ) { /* * If the retry count option is not specified use the default from * the config file. This option is used by the TACOS slave. IN2P3 */ crtycnt = rfioreadopt(RFIO_CONNECT_RETRY_COUNT_OPT); if ( crtycnt <= 0 ) { if ( (p = getenv("RFIO_CONRETRY")) != NULL || (p = getconfent("RFIO", "CONRETRY", 0)) != NULL ) { if ((crtycnt = atoi(p)) <= 0) { crtycnt = 0; } } } serrno = 0 ; crtyint = rfioreadopt(RFIO_CONNECT_RETRY_INT_OPT); if ( crtyint <= 0 ) { if ( (p = getenv("RFIO_CONRETRYINT")) != NULL || (p = getconfent("RFIO", "CONRETRYINT", 0)) != NULL) { if ((crtyint = atoi(p)) <= 0) { crtyint = 0; } } } } crtycnts = crtycnt ; /* * When the NOMORERFIO file exists, or if NOMORERFIO.host file exists, * the RFIO service is suspended. By default it will retry for ever every * DEFRETRYINT seconds. */ if ( (p = getenv("RFIO_RETRY")) == NULL && (p=getconfent("RFIO", "RETRY", 0)) == NULL) { retrycnt=DEFRETRYCNT; } else { retrycnt=atoi(p); } if ( (p = getenv("RFIO_RETRYINT")) == NULL && (p=getconfent("RFIO", "RETRYINT", 0)) == NULL) { retryint=DEFRETRYINT; } else { retryint=atoi(p); } if ( (p = getenv("RFIO_CONNTIMEOUT")) == NULL && (p = getconfent("RFIO", "CONNTIMEOUT", 0)) == NULL) { timeout=DEFCONNTIMEOUT; } else { timeout=atoi(p); } memset(strport, '\0', sizeof(strport)); if (port < 0) { /* Try environment variable */ TRACE(2, "rfio", "rfio_connect: getenv(%s)","RFIO_PORT"); if ((p = getenv("RFIO_PORT")) != NULL) { TRACE(2, "rfio", "rfio_connect: *** Warning: using port %s", p); strncpy(strport, p, sizeof(strport)-1); } else { /* Try CASTOR configuration file */ TRACE(2, "rfio", "rfio_connect: getconfent(%s,%s,0)","RFIO","PORT"); if ((p = getconfent("RFIO","PORT",0)) != NULL) { TRACE(2, "rfio", "rfio_connect: *** Warning: using port %s", p); strncpy(strport, p, sizeof(strport)-1); } else { /* Use default port number */ TRACE(2, "rfio", "rfio_connect: using default port number %d", (int) RFIO_PORT); snprintf(strport, sizeof(strport), "%u", RFIO_PORT); } } } else snprintf(strport, sizeof(strport), "%u", port); /* Warning : the return value of getconfent is a pointer to a thread-specific */ /* content - overwriten at each getconfent. If we do not want to have a corrupted */ /* host value, the following call to getconfent have to be the last one. */ /* Note that subsequent calls to getconfent after this routine are not of concern */ /* because we return a socket value, and do not depend afterwards on this static */ /* thread-specific address used in getconfent(). */ if ( rfioreadopt(RFIO_NETOPT) != RFIO_NONET ) { if ((host = getconfent("NET",node,1)) == NULL) { host = node; } else { TRACE(3,"rfio","set of hosts: %s",host); } } else { host = node; } serrno = 0; /* reset the errno could be SEENTRYNFND */ rfio_errno = 0; TRACE(1, "rfio", "rfio_connect: connecting(%s)",host); cp = strtok(host," \t") ; if (cp == NULL ) { TRACE(1,"rfio","host specified incorrect"); serrno = SENOSHOST; END_TRACE(); return(-1); } conretryall: TRACE(2, "rfio", "rfio_connect: Cgetaddrinfo for host %s", cp); memset(&hints, '\0', sizeof(hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; #ifdef AI_ADDRCONFIG hints.ai_flags |= AI_ADDRCONFIG; #endif gaierrno = Cgetaddrinfo(cp, strport, &hints, &aitop); if (gaierrno == EAI_NONAME) { TRACE(2, "rfio", "rfio_connect: %s: no such host or service",cp); serrno = SENOSHOST; /* No such host */ END_TRACE(); return(-1); } else if (gaierrno != 0) { TRACE(2, "rfio", "rfio_connect: Cgetaddrinfo error: %s", #if defined(_WIN32) Cgai_strerror(gaierrno)); #else (gaierrno == EAI_SYSTEM) ? sstrerror(errno) : Cgai_strerror(gaierrno)); #endif END_TRACE(); return(-1); } #if defined(_WIN32) if (strncmp (NOMORERFIO, "%SystemRoot%\\", 13) == 0 && (p = getenv ("SystemRoot"))) sprintf (nomorebuf1, "%s%s", p, strchr (NOMORERFIO, '\\')); #else strcpy(nomorebuf1, NOMORERFIO); #endif sprintf(nomorebuf2, "%s.%s", nomorebuf1, cp); retry: if (!stat(nomorebuf1,&statbuf)) { if (retrycnt-- >=0) { syslog(LOG_ALERT, "rfio: connect: all RFIO service suspended (pid=%d)\n", getpid()); sleep(retryint); goto retry; } else { syslog(LOG_ALERT, "rfio: connect: all RFIO service suspended (pid=%d), retries exhausted\n", getpid()); serrno=SERTYEXHAUST; return(-1); } } if (!stat(nomorebuf2, &statbuf)) { if (retrycnt-- >=0) { syslog(LOG_ALERT, "rfio: connect: RFIO service to <%s> suspended (pid=%d)\n", cp, getpid()); sleep(retryint); goto retry; } else { syslog(LOG_ALERT, "rfio: connect: RFIO service to <%s> suspended (pid=%d), retries exhausted\n", cp, getpid()); serrno=SERTYEXHAUST; return(-1); } } conretry: #if defined(_WIN32) last_wsa_error = 0; #endif last_error = 0; isconnected = 0; for(ai = aitop; ai && !isconnected; ai=ai->ai_next) { TRACE(2, "rfio", "rfio_connect: socket(%d, %d, %d)", ai->ai_family, ai->ai_socktype, ai->ai_protocol); if ((s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol)) < 0) { TRACE(2, "rfio", "rfio_connect: socket(): ERROR occured (%s)", neterror()); continue; } TRACE(2, "rfio", "rfio_connect: netconnect_timeout(%d, %x, %d, %d)", s, ai->ai_addr, ai->ai_addrlen, timeout); if (netconnect_timeout(s, ai->ai_addr, ai->ai_addrlen, timeout) < 0) { TRACE(2, "rfio", "rfio_connect: connect(): ERROR occured (%s)", neterror()); #if defined(_WIN32) if (WSAGetLastError() == WSAEAFNOSUPPORT) #else if (errno == EAFNOSUPPORT) #endif { (void) close(s); continue; } #if defined(_WIN32) last_wsa_error = WSAGetLastError(); #endif last_error = (serrno) ? serrno : errno; (void) close(s); } else { isconnected = 1; memcpy(&sin,ai->ai_addr,ai->ai_addrlen); } } freeaddrinfo(aitop); if (!isconnected) { #if defined(_WIN32) if (last_wsa_error == WSAECONNREFUSED) #else if (last_error == ECONNREFUSED) #endif { syslog(LOG_ALERT, "rfio: connect: %d failed to connect %s", getpid(), cp); if (crtycnt-- > 0) { if (crtyint) sleep(crtyint); syslog(LOG_ALERT, "rfio: connect: %d retrying to connect %s", getpid(), cp); crtyattmpt ++ ; goto conretry; } if ( ( cp = strtok(NULL," \t")) != NULL ) { crtycnt = crtycnts ; syslog(LOG_ALERT, "rfio: connect: after ECONNREFUSED, changing host to %s", cp) ; TRACE(3,"rfio","rfio: connect: after ECONNREFUSED, changing host to %s", cp) ; goto conretryall; } } #if defined(_WIN32) if (last_wsa_error==WSAENETUNREACH || last_wsa_error==WSAETIMEDOUT || last_error == SETIMEDOUT ) #else if (last_error==EHOSTUNREACH || last_error==ETIMEDOUT || last_error == SETIMEDOUT ) #endif { if ( ( cp = strtok(NULL," \t")) != NULL ) { crtycnt = crtycnts ; #if defined(_WIN32) if (last_wsa_error == WSAENETUNREACH) #else if (last_error == EHOSTUNREACH) #endif syslog(LOG_ALERT, "rfio: connect: after EHOSTUNREACH, changing host to %s", cp); else syslog(LOG_ALERT, "rfio: connect: after ETIMEDOUT, changing host to %s", cp); goto conretryall; } } END_TRACE(); return(-1); } TRACE(3,"rfio", "rfio_connect: OK"); if (crtyattmpt) { syslog(LOG_ALERT, "rfio: connect: %d recovered connection after %d secs with %s", getpid(), crtyattmpt*crtyint,cp) ; } TRACE(4,"rfio", "rfio_connect: calling isremote on node %s", node); { int sav_serrno = serrno; *remote = isremote_sa( (struct sockaddr *)&sin, node ) ; serrno = sav_serrno; /* Failure or not os isremote(), we continue */ } TRACE(4,"rfio", "rfio_connect: after isremote"); Cglobals_get(&last_host_key, (void**)&last_host, last_host_len); strcpy(last_host, cp); /* remember to fetch back remote errs */ TRACE(2, "rfio", "rfio_connect: connected"); TRACE(2, "rfio", "rfio_connect: calling setnetio(%d)", s); if (setnetio(s) < 0) { close(s); END_TRACE(); return(-1); } #ifdef CSEC serrno = 0; Csec_client_initContext(&ctx, CSEC_SERVICE_TYPE_HOST, NULL); if (rfio_apiinit (&thip) == 0 && thip->use_authorization_id && *thip->Csec_mech && *thip->Csec_auth_id) { Csec_client_setAuthorizationId (&ctx, thip->Csec_mech, thip->Csec_auth_id); if (thip->voname && thip->fqan) Csec_client_setVOMS_data (&ctx, thip->voname, thip->fqan, thip->nbfqan); } if (Csec_client_establishContext(&ctx, s) < 0) { TRACE(2, "rfio", "Could not establish an authenticated connection: %s", Csec_getErrorMessage()); (void) netclose(s); Csec_clearContext(&ctx); END_TRACE(); return(-1); } Csec_clearContext(&ctx); #endif TRACE(1, "rfio", "rfio_connect: return socket %d", s); END_TRACE(); return(s); } char *rfio_lasthost() /* returns last succesfully connected host */ { char *last_host = NULL; int last_host_len = 256; Cglobals_get(&last_host_key, (void**)&last_host, last_host_len); TRACE(4, "rfio", "connect: last_host_name: %s", last_host); return(last_host); } int rfio_newhost(newhost) /* returns last succesfully connected host */ char *newhost; { char *last_host = NULL; int last_host_len = 256; if (newhost == NULL || newhost[0] == '\0') return(-1); Cglobals_get(&last_host_key, (void**)&last_host, last_host_len); TRACE(4, "rfio", "connect: last_host_name: changed from %s to %s", last_host, newhost); strncpy(last_host, newhost, 256); last_host[255] = '\0'; return(0); } lcgdm-1.10.0/rfio/chmod.c0000644000175000017500000000603010222773541014416 0ustar ellertellert/* * $Id: chmod.c,v 1.1 2005/03/31 13:13:00 baud Exp $ */ /* * Copyright (C) 1998-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: chmod.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:00 $ CERN/IT/PDP/DM Olof Barring"; #endif /* not lint */ /* chmod.c Remote File I/O - change file mode */ #define RFIO_KERNEL 1 /* KERNEL part of the routines */ #include "rfio.h" /* Remote File I/O general definitions */ int DLL_DECL rfio_chmod(dirpath, mode) /* Remote chmod */ char *dirpath; /* remote directory path */ int mode; /* remote directory mode */ { char buf[BUFSIZ]; /* General input/output buffer */ register int s; /* socket descriptor */ int status; /* remote chmod() status */ int len; char *host, *filename; char *p=buf; int rt ; int rcode ; int parserc; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_chmod(%s, %o)", dirpath, mode); if (!(parserc = rfio_parseln(dirpath,&host,&filename,NORDLINKS))) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file */ TRACE(1,"rfio","rfio_chmod: %s is an HSM path", filename); END_TRACE(); rfio_errno = 0; return(rfio_HsmIf_chmod(filename,mode)); } TRACE(1, "rfio", "rfio_chmod: using local chmod(%s, %o)", filename, mode); END_TRACE(); rfio_errno = 0; status = chmod(filename,mode); if ( status < 0 ) serrno = 0; return(status); } if (parserc < 0) { END_TRACE(); return(-1); } s = rfio_connect(host,&rt); if (s < 0) { END_TRACE(); return(-1); } len = strlen(filename)+ LONGSIZE + 1; if ( RQSTSIZE+len > BUFSIZ ) { TRACE(2,"rfio","rfio_chmod: request too long %d (max %d)", RQSTSIZE+len,BUFSIZ); END_TRACE(); (void) netclose(s); serrno = E2BIG; return(-1); } marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_CHMOD); marshall_WORD(p, geteuid()); marshall_WORD(p, getegid()); marshall_LONG(p, len); p= buf + RQSTSIZE; marshall_STRING(p, filename); marshall_LONG(p, mode); TRACE(1,"rfio","rfio_chmod: mode %o",mode); TRACE(2,"rfio","rfio_chmod: sending %d bytes",RQSTSIZE+len) ; if (netwrite_timeout(s,buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { TRACE(2, "rfio", "rfio_chmod: write(): ERROR occured (errno=%d)", errno); (void) netclose(s); END_TRACE(); return(-1); } p = buf; TRACE(2, "rfio", "rfio_chmod: reading %d bytes", LONGSIZE); if (netread_timeout(s, buf, 2* LONGSIZE, RFIO_CTRL_TIMEOUT) != (2 * LONGSIZE)) { TRACE(2, "rfio", "rfio_chmod: read(): ERROR occured (errno=%d)", errno); (void) netclose(s); END_TRACE(); return(-1); } unmarshall_LONG(p, status); unmarshall_LONG(p, rcode); TRACE(1, "rfio", "rfio_chmod: return %d",status); rfio_errno = rcode; (void) netclose(s); if (status) { END_TRACE(); return(-1); } END_TRACE(); return (0); } lcgdm-1.10.0/rfio/lockf64.c0000644000175000017500000000742610222773541014606 0ustar ellertellert/* * $Id: lockf64.c,v 1.1 2005/03/31 13:13:00 baud Exp $ */ /* * Copyright (C) 1994-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: lockf64.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:00 $ CERN/IT/PDP/DM Antony Simmins, P. Gaillardon"; #endif /* not lint */ /* lockf64.c Remote File I/O - record locking on files */ #define RFIO_KERNEL 1 /* KERNEL part of the routines */ #include "rfio.h" /* Remote File I/O general definitions */ #include "rfio_rfilefdt.h" #include "u64subr.h" int DLL_DECL rfio_lockf64(sd, op, siz) /* Remote lockf */ int sd; /* file descriptor */ int op; /* lock operation */ off64_t siz; /* locked region */ { static char buf[256]; /* General input/output buffer */ int status; /* remote lockf() status */ int len; int replen; char *p=buf; int rt ; int rcode ; int s_index; char tmpbuf[21]; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_lockf64(%d, %d, %s)", sd, op, i64tostr(siz,tmpbuf,0)); /* * The file is local */ if ((s_index = rfio_rfilefdt_findentry(sd,FINDRFILE_WITHOUT_SCAN)) == -1) { TRACE(1, "rfio", "rfio_lockf64: using local lockf64(%d, %d, %s)", sd, op, i64tostr(siz,tmpbuf,0)); END_TRACE(); rfio_errno = 0; status = lockf64(sd,op,siz); if ( status < 0 ) serrno = 0; return(status); } /* * Reject call if bufferized or streamed mode */ if ( rfilefdt[s_index]->_iobuf.base != NULL || rfilefdt[s_index]->version3 ) { TRACE(1, "rfio","rfio_lockf64: lockf rejected in bufferized or streamed mode"); END_TRACE(); errno = EBADF; return(-1); } /* * Repositionning file mark if needed. */ if ( (rfilefdt[s_index]->lseekhow == -1) && ( rfilefdt[s_index]->readissued || rfilefdt[s_index]->preseek ) ) { rfilefdt[s_index]->lseekhow= SEEK_SET ; rfilefdt[s_index]->lseekoff64= rfilefdt[s_index]->offset64 ; } /* * Resetting flags */ rfilefdt[s_index]->eof= 0 ; rfilefdt[s_index]->preseek= 0 ; rfilefdt[s_index]->nbrecord= 0 ; rfilefdt[s_index]->readissued= 0 ; if ( rfilefdt[s_index]->_iobuf.base ) { rfilefdt[s_index]->_iobuf.count= 0 ; rfilefdt[s_index]->_iobuf.ptr= iodata(rfilefdt[s_index]) ; } /* * Sending request. */ len = 1*LONGSIZE+ 2*HYPERSIZE; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_LOCKF64); marshall_LONG(p, rfilefdt[s_index]->lseekhow) ; marshall_LONG(p, len); p= buf + RQSTSIZE; marshall_LONG(p, op); marshall_HYPER(p, siz); marshall_HYPER(p, rfilefdt[s_index]->lseekoff64) ; TRACE(1,"rfio","rfio_lockf64: op %d, siz %s", op, i64tostr(siz,tmpbuf,0)); TRACE(2,"rfio","rfio_lockf64: sending %d bytes",RQSTSIZE+len) ; if (netwrite_timeout(sd, buf, RQSTSIZE+len, RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { TRACE(2, "rfio", "rfio_lockf64: write(): ERROR occurred (errno=%d)", errno); (void) close(sd); END_TRACE(); return(-1); } p = buf; replen = 2*LONGSIZE; TRACE(2, "rfio", "rfio_lockf64: reading %d bytes", replen); if (netread_timeout(sd, buf, replen, RFIO_DATA_TIMEOUT) != replen) { TRACE(2, "rfio", "rfio_lockf64: read(): ERROR occurred (errno=%d)", errno); (void) close(sd); END_TRACE(); return(-1); } unmarshall_LONG(p, status); unmarshall_LONG(p, rcode); TRACE(1, "rfio", "rfio_lockf64: return %d",status); rfio_errno = rcode; if (status) { END_TRACE(); return(-1); } END_TRACE(); return (0); } lcgdm-1.10.0/rfio/mkdir.c0000644000175000017500000000673210222773541014443 0ustar ellertellert/* * $Id: mkdir.c,v 1.1 2005/03/31 13:13:01 baud Exp $ */ /* * Copyright (C) 1994-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: mkdir.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:01 $ CERN/IT/PDP/DM Antony Simmins"; #endif /* not lint */ /* mkdir.c Remote File I/O - make a directory file */ #define RFIO_KERNEL 1 /* KERNEL part of the routines */ #include "rfio.h" /* Remote File I/O general definitions */ int DLL_DECL rfio_mkdir(dirpath, mode) /* Remote mkdir */ char *dirpath; /* remote directory path */ int mode; /* remote directory mode */ { char buf[BUFSIZ]; /* General input/output buffer */ register int s; /* socket descriptor */ int status; /* remote mkdir() status */ int len; char *host; char *filename; char *p=buf; int rt ; int rcode, parserc ; mode_t curmask; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_mkdir(%s, %o)", dirpath, mode); if (!(parserc = rfio_parseln(dirpath,&host,&filename,NORDLINKS))) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file */ TRACE(1,"rfio","rfio_mkdir: %s is an HSM path", filename); END_TRACE(); rfio_errno = 0; return(rfio_HsmIf_mkdir(filename,mode)); } TRACE(1, "rfio", "rfio_mkdir: using local mkdir(%s, %o)", filename, mode); END_TRACE(); rfio_errno = 0; status = mkdir(filename,mode); if ( status < 0 ) serrno = 0; return(status); } if (parserc < 0) { END_TRACE(); return(-1); } /* Applies the umask to the mode */ curmask = umask(0); /* get the mode */ umask(curmask); /* restore it */ mode &= ~curmask; /* and apply it to mode */ len = strlen(filename)+ LONGSIZE + 1; if ( len > BUFSIZ ) { TRACE(2, "rfio", "rfio_mkdir: request too long %d (max %d)", len, BUFSIZ); rfio_errno = 0; serrno = E2BIG; return(-1); } s = rfio_connect(host,&rt); if (s < 0) { END_TRACE(); return(-1); } marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_MKDIR); marshall_WORD(p, geteuid()); marshall_WORD(p, getegid()); marshall_LONG(p, len); p= buf + RQSTSIZE; marshall_STRING(p, filename); marshall_LONG(p, mode); TRACE(1,"rfio","rfio_mkdir: mode %o",mode); TRACE(2,"rfio","rfio_mkdir: sending %d bytes",RQSTSIZE+len) ; if (netwrite_timeout(s,buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { TRACE(2, "rfio", "rfio_mkdir: write(): ERROR occured (errno=%d)", errno); (void) close(s); END_TRACE(); return(-1); } p = buf; TRACE(2, "rfio", "rfio_mkdir: reading %d bytes", LONGSIZE); if (netread_timeout(s, buf, 2* LONGSIZE, RFIO_CTRL_TIMEOUT) != (2 * LONGSIZE)) { TRACE(2, "rfio", "rfio_mkdir: read(): ERROR occured (errno=%d)", errno); (void) close(s); END_TRACE(); return(-1); } unmarshall_LONG(p, status); unmarshall_LONG(p, rcode); TRACE(1, "rfio", "rfio_mkdir: return %d",status); rfio_errno = rcode; (void) close(s); if (status) { END_TRACE(); return(-1); } END_TRACE(); return (0); } lcgdm-1.10.0/rfio/rfio_symlink.man0000644000175000017500000000612410222773541016366 0ustar ellertellert.\" .\" $Id: rfio_symlink.man,v 1.1 2005/03/31 13:13:03 baud Exp $ .\" .\" @(#)$RCSfile: rfio_symlink.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2001 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_SYMLINK 3 "$Date: 2005/03/31 13:13:03 $" CASTOR "Rfio Library Functions" .SH NAME rfio_symlink \- create a symbolic link to a file .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_symlink (const char *" oldpath ", const char *" newpath ");" .br .BI "int rfio_msymlink (const char *" oldpath ", const char *" newpath ");" .br .BI "int rfio_msymlink_reset ();" .br .BI "int rfio_symend ();" .SH DESCRIPTION .B rfio_symlink creates a symbolic link .I newpath which contains the string .IR oldpath . .LP .I newpath may point to a non existing file. .br If .I newpath exists already, it will not be overwritten. .br Write permission is required on .I newpath parent. .LP .B rfio_msymlink is identical to .B rfio_symlink but keeps the connection open to the server unless there are more than MAXMCON connections already opened. This is useful when issuing a series of symlink calls. The last .B rfio_msymlink call should be followed by a call to .BR rfio_symend . .LP .B rfio_msymlink_reset is to be used when your program is forking. In such a case the permanent connections opened with .B rfio_msymlink become shared between the parent and the child. Use .B rfio_msymlink_reset to perform the necessary reset and close of the socket file descriptor in the parent or the child in order to be sure that only of them will receice an answer from the RFIO daemon. .P See NOTES section below. .SH RETURN VALUE This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH NOTES Multiple connections using rfio_msymlink are thread-safe but not process-wide, therefore a forked child can share file descriptors opened with rfio_msymlink by its parent. Use .B rfio_msymlink_reset in such case. .P Multiple connections behaviour is undefined if you work in a multi-threaded environment and with threads \fBnot\fP created using the CASTOR's \fBCthread\fP interface. .SH ERRORS .TP 1.3i .B ENOENT A component of .I newpath prefix does not exist or .I oldpath is a null pathname. .TP .B ENOMEM Insufficient memory. .TP .B EACCES Search permission is denied on a component of the .I newpath prefix or write permission on the .I newpath parent directory is denied. .TP .B EFAULT .I oldpath or .I newpath is a NULL pointer. .TP .B EEXIST .I newpath already exists. .TP .B ENOTDIR A component of the .I newpath prefix is not a directory. .TP .B ENAMETOOLONG The length of .I oldpath or .I newpath exceeds .B CA_MAXPATHLEN or the length of a path component exceeds .BR CA_MAXNAMELEN . .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SECOMERR Communication error. .TP .B SEOPNOTSUP Not supported on Windows. .SH SEE ALSO .BR Castor_limits(4) , .BR rfio_readlink(3) , .BR rfio_unlink(3) , .BR Cthread(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_callhandlers.c0000644000175000017500000002771012245666204017013 0ustar ellertellert/* * $Id: rfio_callhandlers.c 9756 2013-11-28 16:17:08Z dhsmith $ */ /* * Copyright (C) 2005-2007 by CERN/IT/GD/CT * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rfio_callhandlers.c,v $ $Revision: 9756 $ $Date: 2013-11-28 17:17:08 +0100 (Thu, 28 Nov 2013) $ CERN IT-GD/CT Jean-Philippe Baud"; #endif /* not lint */ #include #include #include #include #include #include #if defined(_WIN32) #define MAXHOSTNAMELEN 64 #else #include #include /* For MAXHOSTNAMELEN definition */ #endif #include #if defined(_WIN32) #define R_OK 4 #define W_OK 2 #define X_OK 1 #define F_OK 0 #else #include #endif #include "Csec_api.h" #include "dpm_api.h" #include "dpns_api.h" #include "log.h" #include "rfio_api.h" #include "serrno.h" extern Csec_context_t sec_ctx; extern int set_authorization_id; extern char data_interface[MAXHOSTNAMELEN]; extern char localdomain[MAXHOSTNAMELEN]; extern struct passwd stagersuperuser; static struct { char *principal; uid_t uid; gid_t gid; char **fqan; char *voname; char *user_ca; int nbfqans; } stored; int rfio_handle_store_virtualid(const char *principal) { #ifdef CSEC if (set_authorization_id) { #ifdef VIRTUAL_ID stored.user_ca = Csec_server_get_client_ca (&sec_ctx); #ifdef USE_VOMS stored.voname = Csec_server_get_client_vo (&sec_ctx); stored.fqan = Csec_server_get_client_fqans (&sec_ctx, &stored.nbfqans); #endif if (Cns_getidmapc (principal, stored.user_ca, stored.nbfqans > 1 ? 1 : stored.nbfqans, (const char **)stored.fqan, &stored.uid, &stored.gid)) { log (LOG_ERR, "Could not verify %s by getting a virtual id from the dpm: %s !\n", principal, sstrerror (serrno)); return (-1); } stored.principal = strdup (principal); #endif } #endif return (0); } int rfio_handle_access(const char *sfn, int mode, const char *mech, const char *principal, uid_t uid, gid_t gid, int *need_user_check) { char **fqan = NULL; int nbfqans = 0; char *p; char sfn1[CA_MAXSFNLEN+1]; struct stat64 st; char *user_ca; char *voname = NULL; if (stat64 (sfn, &st) < 0) { serrno = errno; return (-1); } if ((st.st_mode & S_IFMT) != S_IFREG || (st.st_uid != stagersuperuser.pw_uid && st.st_gid != stagersuperuser.pw_gid)) { /* not a file managed by DPM */ *need_user_check = 1; return (0); } strcpy (sfn1, data_interface); if (strchr (sfn1, '.') == NULL) { strcat (sfn1, "."); strcat (sfn1, localdomain); } p = sfn1 + strlen (sfn1); *p++ = ':'; strcpy (p, sfn); #ifdef CSEC if (stored.principal != NULL && !strcmp(stored.principal, principal)) { dpm_client_setAuthorizationId (stored.uid, stored.gid, (char *) mech, (char *) principal); Cns_client_setAuthorizationId (stored.uid, stored.gid, (char *) mech, (char *) principal); if (stored.voname && stored.fqan) { dpm_client_setVOMS_data (stored.voname, stored.fqan, stored.nbfqans); Cns_client_setVOMS_data (stored.voname, stored.fqan, stored.nbfqans); } } else if (set_authorization_id) { #ifdef VIRTUAL_ID user_ca = Csec_server_get_client_ca (&sec_ctx); #ifdef USE_VOMS voname = Csec_server_get_client_vo (&sec_ctx); fqan = Csec_server_get_client_fqans (&sec_ctx, &nbfqans); #endif if (Cns_getidmapc (principal, user_ca, nbfqans > 1 ? 1 : nbfqans, (const char **)fqan, &uid, &gid)) { log (LOG_ERR, "Could not get virtual id: %s !\n", sstrerror (serrno)); return (-1); } #endif dpm_client_setAuthorizationId (uid, gid, (char *) mech, (char *) principal); Cns_client_setAuthorizationId (uid, gid, (char *) mech, (char *) principal); if (voname && fqan) { dpm_client_setVOMS_data (voname, fqan, nbfqans); Cns_client_setVOMS_data (voname, fqan, nbfqans); } } #endif Cns_set_selectsrvr (CNS_SSRV_NOTPATH); if (dpm_accessr (sfn1, mode) < 0) { if (serrno != SEOPNOTSUP || Cns_accessr (sfn1, mode) < 0) return (-1); } *need_user_check = 0; return (0); } int rfio_handle_open(const char *sfn, int flags, int mode, const char *mech, const char *principal, uid_t uid, gid_t gid, char **pfn, void **ctx, int *need_user_check) { int amode; char **fqan = NULL; int nbfqans = 0; char *p; char *parent; char sfn1[CA_MAXSFNLEN+1]; struct stat64 st; char *user_ca; char *voname = NULL; if (stat64 (sfn, &st) < 0) { if (errno != ENOENT || (flags & O_CREAT) == 0) { serrno = errno; return (-1); } if ((parent = strdup (sfn)) == NULL) { serrno = errno; return (-1); } if ((p = strrchr (parent, '/')) == NULL) { free (parent); serrno = EINVAL; return (-1); } if (p != parent) { *p = '\0'; p = parent; } else p = "/"; if (stat64 (p, &st) < 0) { serrno = errno; free (parent); return (-1); } free (parent); } if (st.st_uid != stagersuperuser.pw_uid && st.st_gid != stagersuperuser.pw_gid) { /* not a file managed by DPM */ *pfn = strdup(sfn); *need_user_check = 1; return (0); } strcpy (sfn1, data_interface); if (strchr (sfn1, '.') == NULL) { strcat (sfn1, "."); strcat (sfn1, localdomain); } p = sfn1 + strlen (sfn1); *p++ = ':'; strcpy (p, sfn); #ifdef CSEC if (stored.principal != NULL && !strcmp(stored.principal, principal)) { dpm_client_setAuthorizationId (stored.uid, stored.gid, (char *) mech, (char *) principal); Cns_client_setAuthorizationId (stored.uid, stored.gid, (char *) mech, (char *) principal); if (stored.voname && stored.fqan) { dpm_client_setVOMS_data (stored.voname, stored.fqan, stored.nbfqans); Cns_client_setVOMS_data (stored.voname, stored.fqan, stored.nbfqans); } } else if (set_authorization_id) { #ifdef VIRTUAL_ID user_ca = Csec_server_get_client_ca (&sec_ctx); #ifdef USE_VOMS voname = Csec_server_get_client_vo (&sec_ctx); fqan = Csec_server_get_client_fqans (&sec_ctx, &nbfqans); #endif if (Cns_getidmapc (principal, user_ca, nbfqans > 1 ? 1 : nbfqans, (const char **)fqan, &uid, &gid)) { log (LOG_ERR, "Could not get virtual id: %s !\n", sstrerror (serrno)); return (-1); } #endif dpm_client_setAuthorizationId (uid, gid, (char *) mech, (char *) principal); Cns_client_setAuthorizationId (uid, gid, (char *) mech, (char *) principal); if (voname && fqan) { dpm_client_setVOMS_data (voname, fqan, nbfqans); Cns_client_setVOMS_data (voname, fqan, nbfqans); } } #endif Cns_set_selectsrvr (CNS_SSRV_NOTPATH); amode = (flags & (O_WRONLY|O_TRUNC|O_CREAT)) ? W_OK : R_OK; if (dpm_accessr (sfn1, amode) < 0) { if (serrno != SEOPNOTSUP || Cns_accessr (sfn1, amode) < 0) return (-1); } *pfn = strdup(sfn); *need_user_check = 0; return (0); } int rfio_handle_firstwrite(void *ctx) { return (0); } int rfio_handle_close(void *ctx, struct stat64 *filestat, int close_status) { return (0); } int rfio_handle_remote_open(const char *sfn, const char *mech, const char *principal, uid_t uid, gid_t gid) { char **fqan = NULL; int nbfqans = 0; char *user_ca; char *voname = NULL; #ifdef CSEC if (stored.principal != NULL && !strcmp(stored.principal, principal)) { rfio_client_setAuthorizationId (stored.uid, stored.gid, (char *) mech, (char *) principal); if (stored.voname && stored.fqan) rfio_client_setVOMS_data (stored.voname, stored.fqan, stored.nbfqans); } else if (set_authorization_id) { #ifdef VIRTUAL_ID user_ca = Csec_server_get_client_ca (&sec_ctx); #ifdef USE_VOMS voname = Csec_server_get_client_vo (&sec_ctx); fqan = Csec_server_get_client_fqans (&sec_ctx, &nbfqans); #endif if (Cns_getidmapc (principal, user_ca, nbfqans > 1 ? 1 : nbfqans, (const char **)fqan, &uid, &gid)) { log (LOG_ERR, "Could not get virtual id: %s !\n", sstrerror (serrno)); return (-1); } #endif rfio_client_setAuthorizationId (uid, gid, (char *) mech, (char *) principal); if (voname && fqan) rfio_client_setVOMS_data (voname, fqan, nbfqans); } #endif return (0); } int rfio_handle_stat(const char *sfn, int lflag, const char *mech, const char *principal, uid_t uid, gid_t gid, struct stat *st, int *need_user_check) { char **fqan = NULL; int nbfqans = 0; char *p; char sfn1[CA_MAXSFNLEN+1]; struct Cns_filestatg statbuf; char *user_ca; char *voname = NULL; #if !defined(_WIN32) if (lflag) { if (lstat (sfn, st) < 0) { serrno = errno; return (-1); } } else #endif if (stat (sfn, st) < 0) { serrno = errno; return (-1); } if ((st->st_mode & S_IFMT) != S_IFREG || (st->st_uid != stagersuperuser.pw_uid && st->st_gid != stagersuperuser.pw_gid)) { /* not a file managed by DPM */ *need_user_check = 1; return (0); } strcpy (sfn1, data_interface); if (strchr (sfn1, '.') == NULL) { strcat (sfn1, "."); strcat (sfn1, localdomain); } p = sfn1 + strlen (sfn1); *p++ = ':'; strcpy (p, sfn); #ifdef CSEC if (stored.principal != NULL && !strcmp(stored.principal, principal)) { Cns_client_setAuthorizationId (stored.uid, stored.gid, (char *) mech, (char *) principal); if (stored.voname && stored.fqan) Cns_client_setVOMS_data (stored.voname, stored.fqan, stored.nbfqans); } else if (set_authorization_id) { #ifdef VIRTUAL_ID user_ca = Csec_server_get_client_ca (&sec_ctx); #ifdef USE_VOMS voname = Csec_server_get_client_vo (&sec_ctx); fqan = Csec_server_get_client_fqans (&sec_ctx, &nbfqans); #endif if (Cns_getidmapc (principal, user_ca, nbfqans > 1 ? 1 : nbfqans, (const char **)fqan, &uid, &gid)) { log (LOG_ERR, "Could not get virtual id: %s !\n", sstrerror (serrno)); return (-1); } #endif Cns_client_setAuthorizationId (uid, gid, (char *) mech, (char *) principal); if (voname && fqan) Cns_client_setVOMS_data (voname, fqan, nbfqans); } #endif Cns_set_selectsrvr (CNS_SSRV_NOTPATH); if (Cns_statr (sfn1, &statbuf) < 0) return (-1); st->st_uid = statbuf.uid; st->st_gid = statbuf.gid; st->st_mode = statbuf.filemode; *need_user_check = 0; return (0); } int rfio_handle_stat64(const char *sfn, int lflag, const char *mech, const char *principal, uid_t uid, gid_t gid, struct stat64 *st, int *need_user_check) { char **fqan = NULL; int nbfqans = 0; char *p; char sfn1[CA_MAXSFNLEN+1]; struct Cns_filestatg statbuf; char *user_ca; char *voname = NULL; #if !defined(_WIN32) if (lflag) { if (lstat64 (sfn, st) < 0) { serrno = errno; return (-1); } } else #endif if (stat64 (sfn, st) < 0) { serrno = errno; return (-1); } if ((st->st_mode & S_IFMT) != S_IFREG || (st->st_uid != stagersuperuser.pw_uid && st->st_gid != stagersuperuser.pw_gid)) { /* not a file managed by DPM */ *need_user_check = 1; return (0); } #ifdef CSEC if (uid == 0 && gid == 0) { *need_user_check = 0; return (0); } #endif strcpy (sfn1, data_interface); if (strchr (sfn1, '.') == NULL) { strcat (sfn1, "."); strcat (sfn1, localdomain); } p = sfn1 + strlen (sfn1); *p++ = ':'; strcpy (p, sfn); #ifdef CSEC if (stored.principal != NULL && !strcmp(stored.principal, principal)) { Cns_client_setAuthorizationId (stored.uid, stored.gid, (char *) mech, (char *) principal); if (stored.voname && stored.fqan) Cns_client_setVOMS_data (stored.voname, stored.fqan, stored.nbfqans); } else if (set_authorization_id) { #ifdef VIRTUAL_ID user_ca = Csec_server_get_client_ca (&sec_ctx); #ifdef USE_VOMS voname = Csec_server_get_client_vo (&sec_ctx); fqan = Csec_server_get_client_fqans (&sec_ctx, &nbfqans); #endif if (Cns_getidmapc (principal, user_ca, nbfqans > 1 ? 1 : nbfqans, (const char **)fqan, &uid, &gid)) { log (LOG_ERR, "Could not get virtual id: %s !\n", sstrerror (serrno)); return (-1); } #endif Cns_client_setAuthorizationId (uid, gid, (char *) mech, (char *) principal); if (voname && fqan) Cns_client_setVOMS_data (voname, fqan, nbfqans); } #endif Cns_set_selectsrvr (CNS_SSRV_NOTPATH); if (Cns_statr (sfn1, &statbuf) < 0) return (-1); st->st_uid = statbuf.uid; st->st_gid = statbuf.gid; st->st_mode = statbuf.filemode; *need_user_check = 0; return (0); } lcgdm-1.10.0/rfio/open.c0000644000175000017500000003556512253530542014302 0ustar ellertellert/* * $Id: open.c 9880 2013-12-16 07:53:06Z dhsmith $ */ /* * Copyright (C) 1990-2010 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: open.c,v $ $Revision: 9880 $ $Date: 2013-12-16 08:53:06 +0100 (Mon, 16 Dec 2013) $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy, F. Hassine"; #endif /* not lint */ /* open.c Remote File I/O - open file a file */ #define RFIO_KERNEL 1 /* system part of Remote File I/O */ #include /* system logger */ #include #include #include "rfio.h" /* remote file I/O definitions */ #include "rfio_rfilefdt.h" #include "rfcntl.h" /* remote file control mapping macros */ #if !defined(_WIN32) #include /* for inet_ntoa() */ #include #include #endif #include #include #include #include static int na_key = -1; RFILE *rfilefdt[MAXRFD]; /* File descriptors tables */ static void rfio_setup_ext(iop,uid,gid,passwd) RFILE *iop; int uid; int gid; int passwd; { extern char * getenv() ; /* External declaration */ char * cp ; /* Character pointer */ int v ; char rfio_buf[BUFSIZ] ; if ( cp= getenv("RFIO_READOPT") ) { v = atoi(cp) ; rfiosetopt(RFIO_READOPT, &v , 4) ; } /* * We don't allow READAHEAD without buffering * until the Ultra bug ( or mine ) is fixed. if ( rfioreadopt(RFIO_READOPT) == 2 ) { v = 3 ; rfiosetopt( RFIO_READOPT, &v ,4) ; } */ iop->magic = RFIO_MAGIC; iop->version3 = 0; iop->mode64 = 0; iop->s = -1; if (uid || gid) iop->mapping=0; else iop->mapping=1; iop->passwd=passwd; /* used only if mapping == 0 */ iop->uid = (uid==0 ? geteuid(): uid); iop->gid = (gid==0 ? getegid(): gid); INIT_TRACE("RFIO_TRACE"); TRACE ( 1,"rfio","rfio_setup_ext(%d,%d,%d)",iop,uid,gid); TRACE ( 2,"rfio","rfio_setup_ext: owner s uid is %d",iop->uid); TRACE ( 2,"rfio","rfio_setup_ext: owner s gid is %d",iop->gid); END_TRACE(); (void) umask(iop->umask=umask(0)); iop->bufsize = 0; iop->ftype = FFTYPE_C; iop->binary = 0; /* no translation needed */ iop->eof = 0; iop->unit = 0; iop->access = 0; iop->format = 0; iop->recl = 0; iop->blank = 0; iop->opnopt = 0; iop->offset= 0 ; iop->socset = 0 ; iop->_iobuf.base = NULL; iop->_iobuf.ptr = NULL; iop->_iobuf.count = 0; iop->_iobuf.hsize = 0; iop->_iobuf.dsize = 0; iop->lseekhow= -1 ; iop->ahead= rfioreadopt(RFIO_READOPT) & RFIO_READAHEAD ; iop->eof= 0 ; iop->readissued= 0 ; iop->preseek = 0 ; iop->nbrecord= 0 ; strcpy(iop->host,"????????"); } int rfio_cleanup(s) /* cleanup rfio descriptor */ int s; { int s_index; int HsmType; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_cleanup(%d)", s); if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) != -1) { if (rfilefdt[s_index]->magic != RFIO_MAGIC && rfilefdt[s_index]->magic != B_RFIO_MAGIC) { serrno = SEBADVERSION ; END_TRACE(); return(-1); } if (rfilefdt[s_index]->_iobuf.base != NULL) { TRACE(2, "rfio", "freeing I/O buffer at 0X%X", rfilefdt[s_index]->_iobuf.base); (void) free(rfilefdt[s_index]->_iobuf.base); } TRACE(2, "rfio", "freeing RFIO descriptor at 0X%X", rfilefdt[s_index]); rfio_rfilefdt_freeentry(s_index); TRACE(2, "rfio", "closing %d",s) ; HsmType = rfio_HsmIf_GetHsmType(s,NULL); if ( HsmType > 0 ) { int status = rfio_HsmIf_close(s); if ( HsmType != RFIO_HSM_CNS ) { END_TRACE(); return(status); } } (void) close(s) ; } END_TRACE(); return(0); } int DLL_DECL rfio_open(filepath, flags, mode) char *filepath ; int flags,mode ; { int n; int n_index; int old; int fd; int fd_index; #ifdef O_LARGEFILE /* If O_LARGEFILE go to open64 */ if ( flags & O_LARGEFILE ) return( rfio_open64(filepath, flags, mode) ); #endif /* O_LARGEFILE */ #if ( defined(__osf__) && defined(__alpha) ) || defined(IRIX64) || defined(__ia64__) || defined(__x86_64) || defined(__ppc64__) /* Try to promote into rfio 64 bits call */ /* If 64 is not supported goes to rfio_open_ext */ return( rfio_open64(filepath, flags, mode) ); #else old = rfioreadopt(RFIO_READOPT); if ((old & RFIO_STREAM) == RFIO_STREAM) { /* New V3 stream protocol for sequential transfers is requested */ if ((n = rfio_open_v3(filepath,flags,mode)) < 0) { return(-1); } else { /* To indicate to rfio_open_ext (called directly by rtcopy) that the negotiation has already been done */ int newopt = RFIO_STREAM | RFIO_STREAM_DONE; rfiosetopt(RFIO_READOPT,&newopt,4); /* 4 = dummy len value */ if ((n_index = rfio_rfilefdt_findentry(n,FINDRFILE_WITHOUT_SCAN)) != -1) rfilefdt[n_index]->version3 = 1; return(n); } } else { /* Call previous version */ fd = rfio_open_v2(filepath, flags, mode); if ((fd_index = rfio_rfilefdt_findentry(fd,FINDRFILE_WITHOUT_SCAN)) != -1) rfilefdt[fd_index]->version3 = 0; return(fd); } #endif } int rfio_open_v2(filepath, flags, mode) char * filepath ; int flags,mode ; { char rh[1] ; rh[0]='\0' ; return(rfio_open_ext(filepath, flags, mode,(uid_t)0,(gid_t)0,0,rh,rh)); } /* * Remote file open. * This entry is called from rfio_open64_v2 and rfio_open64_v3 * when server does not support 64 bits mode. */ int rfio_open_ext(filepath, flags, mode,uid,gid,passwd,reqhost,vmstr) char * filepath ; int flags,mode ; uid_t uid; gid_t gid; int passwd ; char * reqhost; /* In case of a Non-mapped I/O with uid & gid sepcified, which host will be contacted for key check ? */ char *vmstr ; { /* * TODO: support special filemode for binary/nobinary. This only * applies to non-ascii machines (e.g. IBM VM/MVS) */ int status ; /* Return code */ int rcode ; /* Remote errno */ int len ; char * host ; char * filename; char * account; char * p ; /* Pointer to rfio buffer */ RFILE * rfp ; /* Remote file pointer */ int rfp_index; WORD req ; struct passwd *pw; int rt ; /* daemon in site(0) or not (1) */ int bufsize ; /* socket buffer size */ extern void rfio_setup_ext(); extern char * getacct() ; extern char * getconfent() ; extern char * getifnam() ; int old,n; int n_index, parserc; char rfio_buf[BUFSIZ]; const char *tname, *tip; /* Avoiding Valgrind error messages about uninitialized data */ memset(rfio_buf, 0, BUFSIZ); INIT_TRACE("RFIO_TRACE"); TRACE(1,"rfio","rfio_open_ext(%s, %d, %d, %d, %d, %d, %s, %s)",filepath,flags,mode,uid,gid,passwd,reqhost,vmstr ) ; /* Note: the call can not be promoted into 64 bits mode */ old = rfioreadopt(RFIO_READOPT); /* New V3 stream protocol for sequential transfers */ /* If RFIO_STREAM_DONE is also set, the negotiation has already been done */ if (old == RFIO_STREAM) { if ((n = rfio_open_ext_v3(filepath,flags,mode,uid,gid,passwd,reqhost,vmstr)) < 0) { return(-1); } else { if ((n_index = rfio_rfilefdt_findentry(n,FINDRFILE_WITHOUT_SCAN)) != -1) rfilefdt[n_index]->version3 = 1; return(n); } } /* Version 2 behaviour starts here */ #if defined (CLIENTLOG) /* Client logging */ rfio_logst(); #endif /* CLIENTLOG */ /* * The file is local. */ if ( ! (parserc = rfio_parse(filepath,&host,&filename)) ) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file */ TRACE(1,"rfio","rfio_open: %s is an HSM path", filename); END_TRACE(); rfio_errno = 0; return(rfio_HsmIf_open(filename,flags,mode,0)); } status= open(filename, flags, mode) ; if ( status < 0 ) serrno = 0; rfio_errno = 0; END_TRACE() ; #if defined (CLIENTLOG) /* Client logging */ rfio_logop(status,filename,host,flags); #endif /* CLIENTLOG */ return status ; } if (parserc < 0) { END_TRACE(); return(-1); } /* * Allocate and initialize a remote file descriptor. */ if ((rfp = (RFILE *)malloc(sizeof(RFILE))) == NULL) { TRACE(2, "rfio", "rfio_open: malloc(): ERROR occured (errno=%d)", errno); END_TRACE(); return(-1); } rfio_setup_ext(rfp,(int)uid,(int)gid,passwd) ; TRACE(2, "rfio", "RFIO descriptor allocated at 0x%X", rfp); /* * Connecting server. */ rfp->s = rfio_connect(host,&rt); if (rfp->s < 0) { TRACE(2, "rfio", "freeing RFIO descriptor at 0X%X", rfp); (void) free(rfp); END_TRACE(); return(-1); } tname = Cgetnetaddress(rfp->s, NULL, 0, &na_key, &tip, NULL, 0, 0); if (tname == NULL || strlen(tip)>=RESHOSTNAMELEN) { TRACE(2, "rfio", "open: Cgetnetaddress: %s\n",(tname == NULL) ? sstrerror(serrno) : "Names too long"); close(rfp->s); (void) free(rfp); END_TRACE(); return(-1); } if (strlen(tname)host, tname); else strcpy(rfp->host, tip); if ( !rt && !rfp->mapping ) { rfp->uid=geteuid() ; rfp->gid=getegid() ; TRACE(3,"rfio", "re-setting (uid,gid) to %d,%d",rfp->uid,rfp->gid) ; rfp->mapping = 1 ; } /* * Remote file table is not large enough. */ if ((rfp_index = rfio_rfilefdt_allocentry(rfp->s)) == -1) { TRACE(2, "rfio", "freeing RFIO descriptor at 0X%X", rfp); (void) close(rfp->s); (void) free(rfp); END_TRACE(); errno= EMFILE ; return -1 ; } rfilefdt[rfp_index]=rfp; /* Set version3 to false since we are running version 2 here */ rfilefdt[rfp_index]->version3 = 0; bufsize= DEFIOBUFSIZE ; if ((p = getenv("RFIO_IOBUFSIZE")) != NULL || (p = getconfent("RFIO", "IOBUFSIZE", 0)) != NULL) { if ((bufsize = atoi(p)) <= 0) { bufsize = DEFIOBUFSIZE; } } else /* reset error code */ serrno=0; TRACE(2, "rfio", "rfio_open: setsockopt(SOL_SOCKET, SO_KEEPALIVE)"); rcode = 1 ; if (setsockopt(rfp->s, SOL_SOCKET, SO_KEEPALIVE,(char *)&rcode, sizeof (int) ) == -1) { TRACE(2, "rfio" ,"rfio_open: setsockopt(SO_KEEPALIVE) failed"); syslog(LOG_ALERT, "rfio: open: setsockopt(SO_KEEPALIVE): %s", strerror(errno)); } if ( (p = getenv("RFIO_TCP_NODELAY")) != NULL ) { rcode = 1; TRACE(2,"rfio","rfio_open: setsockopt(IPPROTO_TCP,TCP_NODELAY)"); if ( setsockopt(rfp->s,IPPROTO_TCP,TCP_NODELAY,(char *)&rcode,sizeof(rcode)) == -1 ) { TRACE(2,"rfio","rfio_open: setsockopt(IPPROTO_TCP,TCP_NODELAY) failed"); } } /* * Allocate, if necessary, an I/O buffer. */ rfp->_iobuf.hsize= 3*LONGSIZE + WORDSIZE ; if ( rfioreadopt(RFIO_READOPT) & RFIO_READBUF ) { rfp->_iobuf.dsize = bufsize - rfp->_iobuf.hsize; if ((rfp->_iobuf.base = malloc(bufsize)) == NULL) { rfio_cleanup(rfp->s); END_TRACE(); return -1 ; } TRACE(2, "rfio", "I/O buffer allocated at 0x%X", rfp->_iobuf.base) ; rfp->_iobuf.count = 0; rfp->_iobuf.ptr = iodata(rfp) ; } if ( (pw = Cgetpwuid(geteuid()) ) == NULL ) { TRACE(2, "rfio" ,"rfio_open: Cgetpwuid() error %s",strerror(errno)); rfio_cleanup(rfp->s); END_TRACE(); return -1 ; } /* * Building and sending request. */ /* if ((account = getacct()) == NULL) */ account = ""; TRACE(2,"rfio","rfio_open: uid %d gid %d umask %o ftype %d, mode %d, flags %d", rfp->uid,rfp->gid,rfp->umask,rfp->ftype,mode,flags) ; TRACE(2,"rfio","rfio_open: account: %s",account) ; TRACE(2,"rfio","rfio_open: filename: %s",filename) ; if (reqhost != NULL && strlen(reqhost) ) TRACE(2,"rfio","rfio_open: requestor's host: %s",reqhost) ; p= rfio_buf ; len= 5*WORDSIZE + 3*LONGSIZE + strlen(account) + strlen(filename) +strlen(pw->pw_name) + strlen(reqhost) + strlen(vmstr) + 5 ; marshall_WORD(p,B_RFIO_MAGIC) ; marshall_WORD(p,RQST_OPEN) ; marshall_LONG(p,len) ; p= rfio_buf + RQSTSIZE ; marshall_WORD(p,rfp->uid) ; marshall_WORD(p,rfp->gid) ; marshall_WORD(p,rfp->umask) ; marshall_WORD(p,FFTYPE_C) ; marshall_LONG(p,htonopnflg(flags)) ; marshall_LONG(p,mode) ; marshall_STRING(p,account) ; marshall_STRING(p,filename) ; marshall_STRING(p,pw->pw_name) ; marshall_STRING(p,reqhost) ; marshall_LONG(p,rfp->passwd); marshall_WORD(p,rfp->mapping); marshall_STRING(p, vmstr) ; TRACE(2,"rfio","rfio_open: sending %d bytes",RQSTSIZE+len) ; if (netwrite_timeout(rfp->s,rfio_buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { TRACE(2,"rfio","rfio_open: write(): ERROR occured (errno=%d)", errno) ; syslog(LOG_ALERT, "rfio: open: %s (error %d with %s) [uid=%d,gid=%d,pid=%d] in netwrite(%d,0X%lX,%d)", strerror(errno), errno, rfp->host, rfp->uid, rfp->gid, getpid(), rfp->s, (unsigned long) rfio_buf, RQSTSIZE+len); rfio_cleanup(rfp->s) ; END_TRACE() ; return -1 ; } /* * Getting status and current offset. */ TRACE(1, "rfio", "rfio_open: reading %d bytes",rfp->_iobuf.hsize) ; if (netread_timeout(rfp->s,rfio_buf,rfp->_iobuf.hsize, RFIO_CTRL_TIMEOUT) != rfp->_iobuf.hsize ) { TRACE(2, "rfio", "rfio_open: read(): ERROR occured (errno=%d)", errno); syslog(LOG_ALERT, "rfio: open: %s (error %d with %s) [uid=%d,gid=%d,pid=%d] in netread(%d,0X%lX,%d)", strerror(errno), errno, rfp->host, rfp->uid, rfp->gid, getpid(), rfp->s, (unsigned long) rfio_buf, RQSTSIZE+len); rfio_cleanup(rfp->s); END_TRACE(); return(-1); } p= rfio_buf ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; TRACE(1,"rfio","rfio_open: return status(%d), rcode(%d), fd: %d",status,rcode,rfp->s) ; if ( status < 0 ) { if ( rcode >= SEBASEOFF) serrno = rcode ; else rfio_errno= rcode ; /* Operation failed but no error message was sent */ if ( rcode == 0 ) serrno = SENORCODE ; rfio_cleanup(rfp->s) ; END_TRACE() ; return -1 ; } else { rfp->offset= status ; } #if defined (CLIENTLOG) /* Client logging */ rfio_logop(rfp->s,filename,host,flags); #endif /* * The file is open, update rfp->fp */ #if defined(hpux) rfp->fp.__fileL = rfp->s; #else #if defined(linux) rfp->fp._fileno = rfp->s; #else #if defined(__Lynx__) rfp->fp._fd = rfp->s; #else rfp->fp._file = rfp->s; #endif /* __Lynx__ */ #endif /* linux */ #endif /* hpux */ END_TRACE() ; return (rfp->s) ; } void rfio_setup(iop) RFILE *iop; { (void)rfio_setup_ext(iop,0,0,0); } lcgdm-1.10.0/rfio/rfio_serv.c0000644000175000017500000016263512264773354015352 0ustar ellertellert/* * $Id: rfio_serv.c 9911 2014-01-13 14:23:40Z dhsmith $ */ /* * Copyright (C) 1990-2010 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rfio_serv.c,v $ $Revision: 9911 $ $Date: 2014-01-13 15:23:40 +0100 (Mon, 13 Jan 2014) $ CERN/IT/PDP/DM Frederic Hemmer"; #endif /* not lint */ /* rfio_serv.c SHIFT remote file access super server */ #define RFIO_KERNEL 1 /* KERNEL part of the programs */ #include #include #include #include #include #include "net.h" #include "rfio.h" /* Remote file I/O */ #include "serrno.h" #include "u64subr.h" #include /* Signal handling */ #include #if defined(_WIN32) #include "syslog.h" #include "log.h" #else #include /* System logger */ #include /* Genralized error logger */ #endif #if !defined(_WIN32) #include /* time definitions */ #include /* System parameters */ #endif #ifndef _WIN32 #include /* wait, wait3, wait4 (BSD) */ #endif #if defined(sun) || defined(_AIX) #include /* Terminal ioctl's */ #include /* resources usage definitions */ #ifndef sun #include /* tty ioctl()'s */ #endif #endif /* sun || _AIX */ #if ( defined(__osf__) && defined(__alpha) ) #include #endif #if defined(sgi) #include /* System Types and Macros */ #include /* tty ioctl()'s */ #include /* Process data area defs. */ #include /* Scheduling definitions */ #endif /* sgi */ #ifndef _WIN32 #include #endif #if defined(_WIN32) #include #else #include #include #include #endif #if ( defined(__osf__) && defined(__alpha) ) || defined(linux) #include #include /* wait, wait3, wait4 (BSD) */ #endif /* __alpha ** __osf__ || linux */ #include #include struct passwd stagersuperuser; static int have_stagersuperuser = 0; /* Default is no alternate super-user */ char data_interface[MAXHOSTNAMELEN]; /* Interface to use */ char localdomain[MAXHOSTNAMELEN]; /* Local domain */ char localhost[MAXHOSTNAMELEN]; /* Local host name */ static int na_key = -1; #ifdef CSEC #include Csec_context_t sec_ctx; uid_t Csec_uid; gid_t Csec_gid; char *Csec_mech; char *Csec_auth_id; int set_authorization_id = 1; #endif extern int Cdomainname (char *, int); extern char *getconfent(); extern int isTrustedHost (int, char *, char *, char *, char *); extern int isremote_sa (struct sockaddr *, char *); static int set_rcv_sockparam(); static int set_snd_sockparam(); #define MAX_LISTEN_SOCKS 16 /* array size for listen sckets */ extern FILE *srpopen(); /* server remote popen() */ extern int sropen(); /* server remote open() */ extern int sropen_v3(); /* server remote open() */ extern int srclose(); /* server remote close() */ extern int srclose_v3(); /* server remote close() */ extern int srwrite(); /* server remote write() */ extern int srwrite_v3(); /* server remote write() */ extern int srread(); /* server remote read() */ extern int srread_v3(); /* server remote read() */ extern int srreadahead(); /* server remote read() ahead */ extern int srlseek(); /* server remote lseek() */ extern int srlseek_v3(); /* server remote lseek() */ extern int srpreseek(); /* server remote preseek() */ extern int srstat(); /* server remote stat() */ extern int srfstat(); /* server remote fstat() */ extern void serrmsg(); /* server remote errmsg() */ extern int srrequest(); /* server read request */ extern int srmkdir(); /* server remote mkdir() */ extern int srrmdir(); /* server remote rmdir() */ extern int srrename(); /* server remote rename() */ extern int srlockf(); /* server remote lockf() */ extern int srchmod(); /* server remote chmod() */ extern int srrcp(); /* server remote rcp() */ extern int sropen64(); /* server remote open() */ extern int sropen64_v3(); /* server remote open() */ extern int srclose64_v3(); /* server remote close() */ extern int srwrite64(); /* server remote write() */ extern int srwrite64_v3(); /* server remote write() */ extern int srread64(); /* server remote read() */ extern int srread64_v3(); /* server remote read() */ extern int srreadahd64(); /* server remote read() ahead */ extern int srlseek64(); /* server remote lseek() */ extern int srpreseek64(); /* server remote preseek() */ extern int srstat64(); /* server remote stat() */ extern int srlockf64(); /* server remote lockf() */ extern int srfstat64(); /* server remote fstat() */ #if !defined(_WIN32) extern int srchown(); /* server remote chown() */ extern int srfchmod(); /* server remote fchmod() */ extern int srfchown(); /* server remote fchown() */ extern int srlstat() ; /* server remote lstat() */ extern int srlstat64() ; /* server remote lstat() */ extern int srsymlink() ; /* server remote symlink() */ extern int srreadlink() ; /* server remote readlink() */ extern DIR *sropendir(); /* server remote opendir() */ extern int srreaddir(); /* server remote readdir() */ extern int srrewinddir(); /* server remote rewinddir() */ extern int srclosedir(); /* server remote closedir() */ extern int sraccess(); /* server remote access() */ #endif #if defined(FORTRAN) extern int srxyopen(); /* server remote xyopen() */ extern int srxyclos(); /* server remote xyclos() */ extern int srxywrit(); /* server remote xywrit() */ extern int srxyread(); /* server remote xyread() */ #endif /* FORTRAN */ extern int setnetio(); /* set network characteristics */ #if defined(_WIN32) extern int standalone; extern char logfile[CA_MAXPATHLEN+1]; extern char *argv0; #else static int standalone=0; /* standalone flag */ static char logfile[CA_MAXPATHLEN+1]; /* log file name buffer */ #endif FILE *streamf ; /* FILE pointer for popen() calls */ int doit(); /* doit() forward reference */ #ifndef _WIN32 void check_child_exit(); #endif #if defined(sun) || defined(_AIX) || ( defined(__alpha) && defined(__osf__)) || defined(linux) void reaper (int); /* reaper() forward reference */ #else #endif /* sun || AIX || __alpha && __osf__ || linux */ fd_set readfd, readmask; struct timeval timeval; #ifndef WTERMSIG #define WTERMSIG(x) (((union wait *)&(x))->w_termsig) #endif /* WTERMSIG */ #ifndef WSTOPSIG #define WSTOPSIG(x) (((union wait *)&(x))->w_stopsig) #endif /* WSTOPSIG */ static int setsock_ceiling = 256 * 1024; int max_rcvbuf; int max_sndbuf; #if defined(_WIN32) /* WIN32 version with multithread support */ #define MAX_THREADS 64 /* */ struct thData { SOCKET ns; /* control socket */ struct sockaddr_storage from; int fromlen; int mode; int _is_remote; int fd; /* all globals, which have to be local for thread */ char *rqstbuf; /* Request buffer */ char *filename; /* file name */ char *iobuffer; /* Data communication buffer */ int iobufsiz; /* Current io buffer size */ SOCKET data_s; /* Data listen socket (v3) */ SOCKET data_sock; /* Data accept socket (v3) */ SOCKET ctrl_sock; /* the control socket (v3) */ int first_write; int first_read; int byte_read_from_network; struct rfiostat myinfo; char from_host[MAXHOSTNAMELEN]; } *td; DWORD tls_i; /* Thread local storage index */ int mt_doit(void **); int mt_cleanup(struct thData *, int *, int); #endif /* WIN32 */ #if defined(_WIN32) rfiod() #else main (argc, argv) int argc; char **argv; #endif { extern int opterr, optind; /* required by getopt(3)*/ extern char *optarg; /* required by getopt(3)*/ #if !defined(_WIN32) register int option; #endif int loglevel = LOG_INFO; /* Default log level */ int debug = 0; /* Debug flag */ int port = 0; /* Non-standard port */ int logging = 0; /* Default not to log */ int singlethread = 0; /* Single threaded */ int lfname = 0; /* log file given */ int nodetach = 0; /* Default detach proces*/ int listen_ipv4only = 0; int listen_ipv6only = 0; char *curdir = NULL; /* Current directory */ #if defined(_WIN32) register SOCKET s, ns; #else register int s, ns; #endif int i, j, pid; int min_rcvbuf, min_sndbuf; struct sockaddr_storage from; struct addrinfo hints, *ai, *aitop; char strport[NI_MAXSERV]; int gaierrno,nfds,num_listen_socks; int listen_socks[MAX_LISTEN_SOCKS]; #if defined(_AIX) socklen_t fromlen; #else int fromlen; #endif int mode; register int maxfds=0; /* max. # of file descr.*/ #if defined(_AIX) struct sigvec sv; #endif #if (defined(__osf__) && defined(__alpha)) || defined (SOLARIS) || defined(linux) struct sigaction sa; #endif #if defined(_WIN32) WSADATA wsadata; int rcode; struct thData *td; struct hostent *hp; /* char *p; */ #endif #ifdef STAGERSUPERUSER struct group *this_group; /* Group structure */ struct passwd *this_passwd; /* password structure pointer */ #endif strcpy(logfile, "syslog"); /* default logfile */ opterr++; #if defined(_WIN32) rcode = WSAStartup(MAKEWORD(2, 0), &wsadata); /* initialization of WinSock DLL */ if( rcode ) { fprintf( stderr, "WSAStartup: %s\n", ws_strerr(rcode) ); exit(1); } tls_i = TlsAlloc(); /* allocation of thread local storage */ if( tls_i == 0xFFFFFFFF ) { /* TLS allocation error */ perror("TlsAlloc"); WSACleanup(); exit(1); } #endif /* if WIN32 */ #if !defined(_WIN32) while ((option = getopt(argc,argv,"46sdltf:p:D:ni:L:")) != EOF) { switch (option) { case '4': listen_ipv4only++; break; case '6': listen_ipv6only++; break; case 'd': debug++; break; case 's': standalone++; break; case 'f': lfname++; strcpy(logfile,optarg); break; case 'l': logging++; break; case 't': singlethread++; break; case 'p': port=atoi(optarg); break; case 'D': curdir = optarg; break; case 'n': nodetach++; break; case 'i': strcpy(data_interface,optarg); break; case 'L': loglevel=atoi(optarg); break; } } #endif /* WIN32 */ if (listen_ipv4only && listen_ipv6only) { fprintf( stderr, "Can not choose to listen for only IPv4 and also only for IPv6\n"); exit(1); } #if !defined(_WIN32) /* * Ignoring SIGXFSZ signals before logging anything */ signal(SIGXFSZ,SIG_IGN); #endif if (debug) { loglevel = LOG_DEBUG; } if (logging && !lfname) { strcpy(logfile, LOGFILE); } if (!(strcmp(logfile,"stderr"))) { strcpy(logfile,""); } if (standalone) { /* * Trap SIGCLD, SIGCHLD */ #if ( defined(__osf__) && defined(__alpha) ) || defined (SOLARIS) || defined(linux) sa.sa_handler = reaper; sa.sa_flags = SA_RESTART; sigaction (SIGCHLD, &sa, NULL); #if ( defined(__osf__) && defined(__alpha) ) || defined (SOLARIS) sigignore(SIGHUP); #endif #endif /* __osf__ && __alpha || SOLARIS || linux */ #if defined(_AIX) sv.sv_mask = sigmask(SIGCHLD)|sigmask(SIGHUP)|sigmask(SIGALRM); sv.sv_handler = reaper; sigvec(SIGCHLD, &sv, (struct sigvec *)0); #endif /* AIX */ #if defined(sgi) || defined(hpux) /* FH */ /* Should trap SIGCLD for kid status */ if (signal(SIGCLD, SIG_IGN) == SIG_ERR) { perror("signal (SIGCLD)"); exit(1); } #endif /* sgi || hpux */ #if !( defined(sgi) || defined(hpux) || defined(SOLARIS) || defined(_WIN32)) maxfds=getdtablesize(); #else maxfds=_NFILE; #endif #if (defined(IRIX5) || defined(IRIX6)) if (!debug) { /* The setsid IRIX man page claims that setsid will */ /* disassociate from controlling terminal provided */ /* that we always first fork. */ pid = fork(); if (pid == -1) { perror("main fork"); exit(1); } if (pid > 0) exit(0); /* Parent terminates */ /* Become session leader - this also disconnect from terminal */ if (setsid() < 0) { perror("main fork"); exit(1); } pid = fork(); if (pid == -1) { perror("second fork"); exit(1); } if (pid > 0) exit(0); /* 1st child terminates */ for (i=0; i< maxfds; i++) (void) close(i); } #else /* IRIX5 || IRIX6 */ /* * disassociate controlling terminal */ #if !defined(_WIN32) if (!debug) { #if defined(_AIX) || defined(sgi) || ( defined(__osf__) && defined(__alpha) ) for (i=0; i< maxfds; i++) (void) close(i); (void) open("/dev/null", O_RDONLY); dup2(0,1); dup2(0,2); i = open("/dev/tty", O_RDWR); if ( i > 0 ) { ioctl(i, TIOCNOTTY, 0); close(i); } #else /* Redirect standard files to /dev/null */ freopen( "/dev/null", "r", stdin); freopen( "/dev/null", "w", stdout); freopen( "/dev/null", "w", stderr); for (i=3; i< maxfds; i++) (void) close(i); #endif /* _AIX || sgi */ /* * Finally fork ourselves if option -n not specified */ if ( !nodetach ) { pid = fork(); if (pid == -1) { perror("main fork"); exit(1); } if (pid > 0) exit(0); #if HPUX10 setpgrp3(); #else #if defined(__Lynx__) setpgrp(0, getpid()); #else #if defined( __APPLE__) setpgid(0, getpid()); #else setpgrp(); #endif #endif #endif } /* if( !nodetach ) */ } /* if( !debug ) */ #endif /* not WIN32 */ #endif /* IRIX5 || IRIX6 */ #if defined(_WIN32) openlog("rfiod", loglevel, LOG_DAEMON); #endif (void) initlog("rfiod", loglevel, logfile); #if defined(__DATE__) && defined (__TIME__) #if defined(_WIN32) log(LOG_ERR, "%s generated on %s %s\n", argv0, __DATE__, __TIME__); #else log(LOG_ERR, "%s generated on %s %s\n",argv[0],__DATE__,__TIME__); #endif /* WIN32 */ #else log(LOG_ERR, "%s\n", argv[0]); #endif /* __DATE__ && __TIME__ */ if (gethostname(localhost,sizeof(localhost))) { log(LOG_ERR, "gethostname(): %s\n",strerror(errno)); exit(1); } if (Cdomainname (localdomain, sizeof(localdomain)) < 0) { log (LOG_ERR, "Unable to get domainname\n"); exit (1); } if (strchr (localhost, '.') == NULL) { strcat (localhost, "."); strcat (localhost, localdomain); } if (*data_interface) { if (strchr (data_interface, '.') == NULL) { strcat (data_interface, "."); strcat (data_interface, localdomain); } } else strcpy (data_interface, localhost); log(LOG_ERR, "starting on %s\n", localhost); if (curdir) { if (chdir(curdir)) log(LOG_ERR, "Can't set the current directory to `%s`\n", curdir); else log(LOG_ERR, "Current directory set to '%s'\n", curdir); } FD_ZERO (&readmask); FD_ZERO (&readfd); if (!port) { log(LOG_ERR, "using default port number %d\n", (int) RFIO_PORT); snprintf(strport, sizeof(strport), "%u", RFIO_PORT); } else { snprintf(strport, sizeof(strport), "%u", port); } memset (&hints, '\0', sizeof(struct addrinfo)); if (listen_ipv4only) hints.ai_family = PF_INET; else if (listen_ipv6only) hints.ai_family = PF_INET6; else hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; if (gaierrno=Cgetaddrinfo (NULL, strport, &hints, &aitop)) { log(LOG_ERR, "Cgetaddrinfo(): %s\n", #if defined(_WIN32) Cgai_strerror(gaierrno)); #else (gaierrno != EAI_SYSTEM) ? Cgai_strerror(gaierrno) : strerror(errno)); #endif exit(1); } num_listen_socks = 0; for(ai=aitop;ai;ai=ai->ai_next) { int fo = 0; if (ai->ai_family != PF_INET && ai->ai_family != PF_INET6) continue; if (num_listen_socks>=MAX_LISTEN_SOCKS) { log(LOG_ERR, "Too many listen sockets\n"); exit(1); } #if defined(_WIN32) if( (s = socket(ai->ai_family,ai->ai_socktype,ai->ai_protocol)) == INVALID_SOCKET ) { continue; } #else if( (s = socket(ai->ai_family,ai->ai_socktype,ai->ai_protocol)) < 0) { continue; } #endif { /* Re-usable port */ int bool = 1; setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *)&bool, sizeof(bool)); if (ai->ai_family == PF_INET6) { #ifdef IPV6_V6ONLY if (setsockopt (s, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&bool, sizeof(bool))) { fo = 1; } #else fo = 1; #endif } } serrno = 0; if( bind(s, ai->ai_addr, ai->ai_addrlen) == SOCKET_ERROR ) { log(LOG_ERR, "bind(): %s\n", neterror()); netclose(s); continue; } if (fo) { #ifdef IPV6_V6ONLY log(LOG_ERR, "Was not able to set the IPV6_V6ONLY socket option on the IPv6 listen socket\n"); #else log(LOG_ERR, "Was compiled on a system that does not support the IPV6_V6ONLY socket option\n"); #endif if (listen_ipv6only) { log(LOG_ERR, "Not proceeding as the IPv6 only flag was specified\n"); exit(1); } log(LOG_ERR, "Incoming IPv4 will be accepted and handled as IPv4-mapped IPv6 addresses\n"); } listen_socks[num_listen_socks] = s; ++num_listen_socks; listen(s, 5); } freeaddrinfo(aitop); if (num_listen_socks == 0) { log(LOG_ERR, "Could not listen on any sockets\n"); #ifdef _WIN32 WSACleanup(); TlsFree(tls_i); #endif exit(1); } min_rcvbuf = setsock_ceiling; min_sndbuf = setsock_ceiling; nfds = -1; for(i=0;infds) nfds = s; for (j = setsock_ceiling ; j >= 16 * 1024 ; j >>= 1) { if (set_rcv_sockparam(s, j) == j) { if (j= 16 * 1024 ; j >>= 1) { if (set_snd_sockparam(s,j) == j) { if (jgr_gid) { log(LOG_ERR, "\"%s\"'s gid (%d) is not the primary group of account \"%s\" (%d) - No alternate super-user defined\n", STAGERSUPERGROUP, (int) this_group->gr_gid, STAGERSUPERUSER, (int) stagersuperuser.pw_uid); log(LOG_ERR, "Please check existence of primary account (\"%s\",\"%s\")=(%d,%d) in password file\n", STAGERSUPERUSER, STAGERSUPERGROUP, (int) stagersuperuser.pw_uid, (int) this_group->gr_gid); log(LOG_ERR, "No alternate super-user in action\n"); } else { /* An alternate super-user has been defined */ log(LOG_INFO, "Allowing the alternate super-user privileges for account: (\"%s\",\"%s\")=(%d,%d)\n", STAGERSUPERUSER, STAGERSUPERGROUP, (int) stagersuperuser.pw_uid, (int) stagersuperuser.pw_gid); have_stagersuperuser = 1; } } #else log(LOG_INFO,"Checking existence of alternate super-group %d in group file\n", (int) stagersuperuser.pw_gid); if ((this_group = Cgetgrgid(stagersuperuser.pw_gid)) == NULL) { log(LOG_ERR, "Cannot Cgetgrgid(%d) (%s)\n",(int) stagersuperuser.pw_gid,strerror(errno)); log(LOG_ERR, "Please check existence of group %d in group file\n", (int) stagersuperuser.pw_gid); log(LOG_ERR, "No alternate super-user in action\n"); } else { /* An alternate super-user has been defined */ log(LOG_INFO, "Allowing the alternate super-user privileges for account: (\"%s\",\"%s\")=(%d,%d)\n", STAGERSUPERUSER, this_group->gr_name, (int) stagersuperuser.pw_uid, (int) stagersuperuser.pw_gid); have_stagersuperuser = 1; } #endif } #else log(LOG_INFO,"No alternate super-user configured (STAGERSUPERUSER)\n"); #endif for (;;) { #ifndef _WIN32 check_child_exit(); /* check childs [pid,status] */ #endif for(i=0;ins = ns; memcpy(&(td->from), (void*)&from, sizeof(from)); td->fromlen = fromlen; td->mode = 1; td->_is_remote = 0; { const char *tip; const char *p = Cgetnetaddress(-1,&from,fromlen,&na_key,&tip,NULL,0,0); if (p == NULL || strlen(tip)>=MAXHOSTNAMELEN) { log(LOG_ERR, "unable to lookup peer address or name\n"); closesocket(ns); free(td); continue; } if (p != NULL && strlen(p)from_host, p); else strcpy(td->from_host, tip); if (strcmp(tip,td->from_host)) log(LOG_INFO, "connection from [%s] (%s)\n", tip, td->from_host); else log(LOG_INFO, "connection from [%s]\n", tip); } /* * Detect whether client is in or out of site */ { int sav_serrno = serrno; if( isremote_sa((struct sockaddr *)&from, td->from_host) ) td->_is_remote++; serrno = sav_serrno; /* Failure or not of isremote(), we continue */ } pid = _beginthread(mt_doit, 0, (void*)td ); if( pid == -1 ) { log(LOG_ERR, "_beginthread: %s\n", strerror(errno)); closesocket(ns); free(td); continue; } #else pid = fork(); switch (pid) { case -1: log(LOG_ERR,"fork(): %s \n",strerror(errno)); break; case 0: /* Child */ for(j=0;jrqstbuf = (char*)malloc(BUFSIZ); if( td->rqstbuf == NULL ) { perror("malloc"); exit(1); } td->filename = (char*)malloc(MAXFILENAMSIZE); if( td->filename == NULL ) { perror("malloc"); exit(1); } res = TlsSetValue(tls_i, (LPVOID)td); if( res == 0 ) { perror("TlsSetValue"); exit(1); } res = doit( td->ns, td->from, td->fromlen, td->mode ); return (res); } int mt_cleanup(struct thData *td, int *fd, int rcode) { if( *fd >= 0 ) close(*fd); *fd = -1; if( rcode > 0 ) { log(LOG_INFO, "mt_cleanup: closing control socket %d", td->ns); shutdown(td->ns, SD_BOTH); closesocket(td->ns); } free(td->rqstbuf); free(td->filename); log(LOG_INFO, "mt_cleanup: freeing thread data pointer at 0X%X", td); free(td); return rcode; } #endif doit(s, fromp, fromlen, mode) #if defined(_WIN32) SOCKET s; #else int s; #endif struct sockaddr *fromp; #if defined(_AIX) socklen_t fromlen; #else int fromlen; #endif int mode; { int request, status; /* Request Id number */ int fd = -1; /* Local fd -> -1 */ #if !defined(_WIN32) DIR *dirp = NULL; /* Local dir ptr -> NULL */ #endif int lun; int access; int yes = 1; struct rfiostat info; int is_remote = 0; /* Is requestor in another site ? */ char from_host[MAXHOSTNAMELEN]; /* Where the request comes from */ char * p1 ; #if defined(sgi) register int ndpri; #endif /* sgi */ #if defined(_AIX) struct sigvec sv; #endif #if (defined(__osf__) && defined(__alpha)) || defined(linux) struct sigaction sa; #endif char tmpbuf[21], tmpbuf2[21]; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif /* WIN32 */ /* * Getting the client host name. */ #if !defined(_WIN32) { const char *tip; const char *p = Cgetnetaddress(-1,fromp,fromlen,&na_key,&tip,NULL,0,0); if (p == NULL || strlen(tip)>=MAXHOSTNAMELEN) { log(LOG_ERR, "doit(%d): unable to lookup peer address or name\n", s); close(s); if (mode) return(1); else exit(1); } if (strlen(p)from_host); #endif #ifdef CSEC /* Perfom the authentication */ Csec_server_initContext(&sec_ctx, CSEC_SERVICE_TYPE_HOST, NULL); if (Csec_server_establishContext(&sec_ctx, s)<0) { log(LOG_ERR, "Could not establish an authenticated connection: %s !\n", Csec_getErrorMessage()); closesocket(s); if (mode) return(1); else exit(1); } Csec_server_getClientId(&sec_ctx, &Csec_mech, &Csec_auth_id); Csec_uid = Csec_gid = -1; if (strcmp (Csec_mech, "ID") == 0 || Csec_isIdAService (Csec_mech, Csec_auth_id) >= 0) { if (isTrustedHost (s, localhost, localdomain, "RFIOD", "TRUST")) { if (Csec_server_getAuthorizationId (&sec_ctx, &Csec_mech, &Csec_auth_id) < 0) { Csec_uid = stagersuperuser.pw_uid; Csec_gid = stagersuperuser.pw_gid; set_authorization_id = 0; } } else { log (LOG_ERR, "Host is not trusted, identity provided was (%s,\"%s\")\n", Csec_mech, Csec_auth_id); closesocket(s); if (mode) return(1); else exit(1); } } if (rfio_handle_store_virtualid (Csec_auth_id)<0) { closesocket(s); if (mode) return(1); else exit(1); } log(LOG_INFO, "request by %s (%d,%d)\n", Csec_auth_id, Csec_uid, Csec_gid); #endif /* * Initializing the info data structure. */ info.readop= 0 ; info.writop= 0 ; info.flusop= 0 ; info.statop= 0 ; info.seekop= 0 ; info.presop= 0 ; info.aheadop=0 ; info.mkdiop= 0 ; info.renaop= 0 ; info.lockop= 0 ; info.rnbr= (off64_t)0 ; info.wnbr= (off64_t)0 ; /* * Use to solve an UltraNet bug */ #if !defined(_WIN32) if (setnetio(s) <0) { shutdown(s, 2); close(s); exit(1); } #endif /* _WIN32 */ if ( (p1 = getconfent("RFIOD","KEEPALIVE",0)) != NULL && !strcmp(p1,"YES") ) { if (setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,(char *)&yes, sizeof (int) ) == -1) { log(LOG_ERR,"setsockopt(SO_KEEPALIVE) failed"); } /* * Trap SIGPIPE */ #if defined(sgi) || defined(hpux) || defined(SOLARIS) (void) signal(SIGPIPE,reaper) ; #endif /* sgi || hpux || SOLARIS */ #if defined(_AIX) sv.sv_mask = sigmask(SIGCHLD)|sigmask(SIGHUP)|sigmask(SIGALRM); sv.sv_handler = reaper; sigvec(SIGPIPE, &sv, (struct sigvec *)0); #endif /* AIX */ #if ( defined(__osf__) && defined(__alpha) ) || defined(linux) sa.sa_handler = reaper; sa.sa_flags = SA_RESTART; sigaction (SIGPIPE, &sa, NULL); #endif /* __osf__ && __alpha || linux */ } #if !defined(_WIN32) else { /* * Ignoring SIGPIPE and SIGXFSZ signals. */ (void) signal(SIGPIPE,SIG_IGN) ; (void) signal(SIGXFSZ,SIG_IGN) ; } #endif /* * Detect wether client is in or out of site */ #if !defined(_WIN32) { int sav_serrno = serrno; if ( isremote_sa(fromp,from_host) ) is_remote++; serrno = sav_serrno; /* Failure or not of isremote(), we continue */ } #else is_remote = td->_is_remote; #endif /* WIN32 */ /* * Locking program in memory and setting a non degrading * priority if specified in the configuration file. */ #if defined(sgi) if ((p1 = getconfent("RFIO","RESIDENT",0)) != NULL) { if ( !strcmp(p1,"1") ) { /* * Lock program in memory */ if ( prctl(PR_RESIDENT) < 0) log(LOG_INFO,"prctl(PR_RESIDENT): %s\n",strerror(errno)) ; else log(LOG_INFO,"Daemon locked\n"); } } if ((p1 = getconfent("RFIO","NDPRIORITY",0)) != NULL) { ndpri= atoi(p1) ; if ((ndpri < NDPHIMAX) || (ndpri > NDPLOMIN)) log(LOG_INFO,"Invalid non-degrading priority: %d\n",ndpri) ; else if (schedctl(NDPRI, 0, ndpri) < 0) log(LOG_INFO,"schedctl(%d,%d,%d): %s\n",NDPRI,0,ndpri,strerror(errno)) ; else log(LOG_INFO,"schedctl(%d,%d,%d) done\n",NDPRI,0,ndpri) ; } #endif /* sgi */ /* * Loop on request. */ for (;;) { int bet ; request = srrequest(s, &bet); if ( (request==RQST_OPEN || request==RQST_XYOPEN) && !bet && is_remote ) { log(LOG_ERR,"Attempt to call daemon with expired magic from outside site\n"); #if defined(_WIN32) return(mt_cleanup(td, &fd, 1)); #else /* WIN32 */ shutdown(s, 2); close(s); if (mode) return(1); else exit(1); #endif } if (request < 0) { log(LOG_INFO,"drop_socket(%d): %d read, %d readahead, %d write, %d flush, %d stat, %d lseek and %d lockf\n", s, info.readop, info.aheadop, info.writop, info.flusop, info.statop, info.seekop, info.lockop); log(LOG_INFO,"drop_socket(%d): %s bytes read and %s bytes written\n", s, u64tostr(info.rnbr,tmpbuf,0),u64tostr(info.wnbr,tmpbuf2,0)) ; log(LOG_ERR, "fatal error on socket %d: %s\n", s, strerror(errno)); #if defined(_WIN32) return(mt_cleanup(td, &fd, 1)); #else shutdown(s, 2); close(s); if (mode) return(1); else exit(1); #endif } switch (request) { case 0: log(LOG_INFO, "close_socket(%d): %d read, %d readahead, %d write, %d flush, %d stat, %d lseek and %d lockf\n", s, info.readop, info.aheadop, info.writop, info.flusop, info.statop, info.seekop, info.lockop); log(LOG_INFO,"close_socket(%d): %s bytes read and %s bytes written\n", s, u64tostr(info.rnbr,tmpbuf,0), u64tostr(info.wnbr,tmpbuf2,0)) ; log(LOG_ERR, "connection %d dropped by remote end\n", s); #if defined(SACCT) rfioacct(0,0,0,s,0,0,status,errno,&info,NULL,NULL); #endif /* SACCT */ #if defined(_WIN32) return(mt_cleanup(td, &fd, 1)); #endif shutdown(s, 2); if( close(s) < 0 ) log(LOG_ERR, "Error closing socket fildesc=%d, errno=%d\n", s, errno); else log(LOG_INFO, "Closing socket fildesc=%d\n", s); if( mode ) return(1); else exit(1); case RQST_CHKCON : log(LOG_DEBUG, "request type : check connect\n"); srchk(s) ; #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif shutdown(s, 2); close(s); if (mode) return(0); else exit(0); break; case RQST_OPEN : log(LOG_DEBUG, "request type \n"); fd = sropen(s,(bet?is_remote:0),(bet?from_host:(char *)NULL), bet); log(LOG_DEBUG, "ropen() returned: %d\n",fd); break; case RQST_OPEN64 : log(LOG_DEBUG, "request type \n"); fd = sropen64(s, is_remote, from_host); log(LOG_DEBUG, "ropen64() returned: %d\n",fd); break; #if !defined(_WIN32) case RQST_OPENDIR : log(LOG_DEBUG, "request type \n"); dirp = sropendir(s,is_remote,from_host,bet); log(LOG_DEBUG, "ropendir() returned %x\n",dirp); break; #endif /* WIN32 */ case RQST_CLOSE : log(LOG_DEBUG, "request type \n"); status = srclose(s, &info, fd); log(LOG_DEBUG,"close() returned %d\n",status); fd = -1; #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif shutdown(s, 2); close(s); if (mode) return(0); else exit(0); #if !defined(_WIN32) case RQST_CLOSEDIR : log(LOG_DEBUG, "request type \n"); status = srclosedir(s,&info,dirp); log(LOG_DEBUG,"closedir() returned %d\n",status); dirp = NULL; shutdown(s,2); close(s); if (mode) return(0); else exit(0); break; #endif /* WIN32 */ case RQST_READ : info.readop ++ ; log(LOG_DEBUG, "request type \n"); status = srread(s, &info, fd); log(LOG_DEBUG, "rread() returned: %d\n",status); break; case RQST_READ64 : info.readop ++ ; log(LOG_DEBUG, "request type \n"); status = srread64(s, &info, fd); log(LOG_DEBUG, "rread64() returned: %d\n",status); break; case RQST_READAHEAD : info.aheadop ++ ; log(LOG_DEBUG, "request type \n"); status = srreadahead(s, &info, fd); log(LOG_DEBUG, "rreadahead() returned: %d\n",status); break; case RQST_READAHD64 : info.aheadop ++ ; log(LOG_DEBUG, "request type \n"); status = srreadahd64(s, &info, fd); log(LOG_DEBUG, "rreadahd64() returned: %d\n",status); break; #if !defined(_WIN32) case RQST_READDIR : info.readop++; log(LOG_DEBUG, "request type \n"); status = srreaddir(s,&info,dirp); log(LOG_DEBUG, "rreaddir() returned: %d\n",status); break; #endif /* WIN32 */ case RQST_WRITE : info.writop ++ ; log(LOG_DEBUG, "request type \n"); status = srwrite(s, &info, fd); log(LOG_DEBUG, "rwrite() returned: %d\n",status); break; case RQST_WRITE64 : info.writop ++ ; log(LOG_DEBUG, "request type \n"); status = srwrite64(s, &info, fd); log(LOG_DEBUG, "rwrite64() returned: %d\n",status); break; #if !defined(_WIN32) case RQST_FCHMOD : log(LOG_DEBUG, "request type \n"); status = srfchmod(s, from_host, is_remote, fd) ; log(LOG_DEBUG, "fchmod() returned %d\n",status); break; case RQST_FCHOWN : log(LOG_DEBUG, "request type \n"); status = srfchown(s, from_host, is_remote, fd) ; log(LOG_DEBUG, "fchown() returned %d\n",status); break; #endif /* WIN32 */ case RQST_FSTAT : info.statop ++ ; log(LOG_DEBUG, "request type \n"); status = srfstat(s, &info, fd); log(LOG_DEBUG, "fstat() returned %d\n",status); break; case RQST_FSTAT64 : log(LOG_DEBUG, "request type \n"); status = srfstat64(s, &info, fd); log(LOG_DEBUG, "fstat64() returned %d\n",status); break; case RQST_MSTAT_SEC: case RQST_STAT_SEC: case RQST_MSTAT: case RQST_STAT : log(LOG_DEBUG, "request type \n"); status = srstat(s,(bet?is_remote:0),(bet?from_host:(char *)NULL),bet); log(LOG_DEBUG, "stat() returned %d\n",status); if (request==RQST_STAT || request==RQST_STAT_SEC) { #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ shutdown(s, 2); close(s); if(mode) return(0); else exit(0); } /* if request == RQST_STAT */ break ; #if !defined(_WIN32) case RQST_LSTAT_SEC: case RQST_LSTAT : log(LOG_DEBUG, "request type \n"); status = srlstat(s,(bet?is_remote:0),(bet?from_host:(char *)NULL),bet); log(LOG_DEBUG, "lstat() returned %d\n",status); shutdown(s,2); close(s); if (mode) return(0); else exit(0); #endif /* WIN32 */ case RQST_LSEEK : info.seekop ++ ; log(LOG_DEBUG, "request type \n"); status = srlseek(s, &info, fd); log(LOG_DEBUG, "lseek() returned %d\n",status); break; case RQST_LSEEK64 : case RQST_LSEEK64_V3 : info.seekop ++ ; log(LOG_DEBUG, "request type \n"); status = srlseek64(s, request, &info, fd); log(LOG_DEBUG, "lseek64() returned %d\n",status); break; case RQST_PRESEEK : info.presop ++ ; log(LOG_DEBUG, "request type \n"); status = srpreseek(s, &info, fd); log(LOG_DEBUG, "preseek() returned %d\n",status); break; case RQST_PRESEEK64 : info.presop ++ ; log(LOG_DEBUG, "request type \n"); status = srpreseek64(s, &info, fd); log(LOG_DEBUG, "preseek64() returned %d\n",status); break; case RQST_ERRMSG : log(LOG_DEBUG, "request type \n"); srerrmsg(s); #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ shutdown(s,2); close(s); if (mode) return(0); else exit(0); #if !defined(_WIN32) case RQST_MSYMLINK : case RQST_SYMLINK : log(LOG_DEBUG, "request type \n"); status = srsymlink(s,request,(bet?is_remote:0),(bet?from_host:(char *)NULL)) ; log(LOG_DEBUG, "srsymlink() returned %d\n", status) ; if (request==RQST_SYMLINK) { shutdown(s,2); close(s); if (mode) return(0); else exit(0); } break; case RQST_READLINK: log(LOG_DEBUG, "request type \n"); status = srreadlink(s) ; shutdown(s,2); close(s); log(LOG_DEBUG, "srreadlink() returned %d\n", status) ; if (mode) return(0); else exit(0); case RQST_REWINDDIR: info.seekop ++; log(LOG_DEBUG, "request type \n"); status = srrewinddir(s,&info,dirp); log(LOG_DEBUG, "srrewinddir() returned %d\n",status); break; #endif /* WIN32 */ case RQST_STATFS : log(LOG_DEBUG, "request type \n"); status = srstatfs(s) ; log(LOG_DEBUG, "statfs() returned %d\n",status); #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ shutdown(s,2); close(s); if (mode) return(0); else exit(0); case RQST_POPEN : log(LOG_DEBUG, "request type \n"); streamf = srpopen(s, from_host, (bet?is_remote:0) ) ; log(LOG_DEBUG, "srpopen() returned %x\n", streamf ) ; break ; case RQST_FREAD : log(LOG_DEBUG,"request type \n"); status = srfread(s,streamf) ; log(LOG_DEBUG, "rfread() returned %d\n",status); break ; case RQST_FWRITE : log(LOG_DEBUG,"request type \n"); status = srpclose(s,streamf) ; log(LOG_DEBUG,"pclose() returned %d\n",status); #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ shutdown(s,2); close(s); if (mode) return(0); else exit(0); #if !defined(_WIN32) case RQST_ACCESS : log(LOG_DEBUG,"request type \n"); status = sraccess(s, from_host, (bet?is_remote:0)) ; log(LOG_DEBUG,"raccess returned %d\n",status); shutdown(s,2); close(s); if (mode) return(0); else exit(0); #endif /* WIN32 */ case RQST_MKDIR : log(LOG_DEBUG,"request type \n"); status = srmkdir(s,from_host,is_remote) ; log(LOG_DEBUG,"rmkdir returned %d\n", status); #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ shutdown(s,2); close(s); if (mode) return(0); else exit(0); case RQST_RMDIR : log(LOG_DEBUG,"request type \n"); status = srrmdir(s,from_host,is_remote) ; log(LOG_DEBUG,"rrmdir returned %d\n", status); #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ shutdown(s,2); close(s); if (mode) return(0); else exit(0); case RQST_CHMOD: log(LOG_DEBUG,"request type \n"); status = srchmod(s,from_host,is_remote) ; log(LOG_DEBUG,"rchmod returned %d\n", status); #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ shutdown(s,2); close(s); if (mode) return(0); else exit(0); #if !defined(_WIN32) case RQST_CHOWN: log(LOG_DEBUG,"request type \n"); status = srchown(s,from_host,is_remote) ; log(LOG_DEBUG,"rchown returned %d\n", status); shutdown(s,2); close(s); if (mode) return(0); else exit(0); #endif /* WIN32 */ case RQST_RCP: log(LOG_DEBUG,"request type \n"); status = srrcp(s,from_host,is_remote) ; log(LOG_DEBUG,"rrcp returned %d\n", status); #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ shutdown(s,2); close(s); if (mode) return(0); else exit(0); case RQST_RENAME: log(LOG_DEBUG,"request type \n"); status = srrename(s,from_host,is_remote) ; log(LOG_DEBUG,"rrename returned %d\n", status); #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ shutdown(s,2); close(s); if (mode) return(0); else exit(0); #if !defined(_WIN32) case RQST_LOCKF: log(LOG_DEBUG,"request type \n"); status = srlockf(s,fd) ; log(LOG_DEBUG,"rlockf returned %d\n", status); break; case RQST_LOCKF64: log(LOG_DEBUG,"request type \n"); status = srlockf64(s, &info, fd) ; log(LOG_DEBUG,"rlockf64 returned %d\n", status); break; #endif /* WIN32 */ case RQST_END : log(LOG_DEBUG,"request type : end rfiod\n") ; #if defined(SACCT) rfioacct(RQST_END,0,0,s,0,0,status,errno,&info,NULL,NULL); #endif /* SACCT */ #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ shutdown(s,2); close(s); if (mode) return(0); else exit(0); break ; case RQST_OPEN_V3: log(LOG_DEBUG,"request type : open_v3\n"); fd = sropen_v3(s,(bet?is_remote:0),(bet?from_host:(char *)NULL), bet); log(LOG_DEBUG,"ropen_v3 returned %d\n",fd); break; case RQST_CLOSE_V3: /* Should not be received here but inside read_v3 and write_v3 functions */ log(LOG_DEBUG,"request type : close_v3\n"); status = srclose_v3(s,&info,fd); log(LOG_DEBUG,"rclose_v3 returned %d\n", status); fd = -1; #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ shutdown(s,2); close(s); if (mode) return(0); else exit(0); break; case RQST_READ_V3: log(LOG_DEBUG,"request type : read_v3\n"); status = srread_v3(s,&info,fd); log(LOG_DEBUG,"rread_v3 returned %d\n",status); #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ fd = -1; shutdown(s,2); close(s); if (mode) return(0); else exit(0); break; case RQST_WRITE_V3: log(LOG_DEBUG,"request type : write_v3\n"); status = srwrite_v3(s,&info,fd); log(LOG_DEBUG,"rwrite_v3 returned %d\n",status); #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ fd = -1; shutdown(s,2); close(s); if (mode) return(0); else exit(0); break; case RQST_LSEEK_V3: info.seekop++; log(LOG_DEBUG, "request type lseek_v3()\n"); status = srlseek_v3(s, &info, fd); log(LOG_DEBUG, "lseek_v3() returned %d\n",status); break; case RQST_OPEN64_V3: log(LOG_DEBUG,"request type : open64_v3\n"); fd = sropen64_v3(s, is_remote, from_host); log(LOG_DEBUG,"ropen64_v3 returned %d\n",fd); break; case RQST_CLOSE64_V3: /* Should not be received here but inside read_v3 and write_v3 functions */ log(LOG_DEBUG,"request type : close64_v3\n"); status = srclose64_v3(s,&info,fd); log(LOG_DEBUG,"rclose64_v3 returned %d\n", status); fd = -1; #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ shutdown(s,2); close(s); if (mode) return(0); else exit(0); break; case RQST_READ64_V3: log(LOG_DEBUG,"request type : read64_v3\n"); status = srread64_v3(s,&info,fd); log(LOG_DEBUG,"rread64_v3 returned %d\n",status); #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ fd = -1; shutdown(s,2); close(s); if (mode) return(0); else exit(0); break; case RQST_WRITE64_V3: log(LOG_DEBUG,"request type : write64_v3\n"); status = srwrite64_v3(s,&info,fd); log(LOG_DEBUG,"rwrite64_v3 returned %d\n",status); #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ fd = -1; shutdown(s,2); close(s); if (mode) return(0); else exit(0); break; #if defined(FORTRAN) case RQST_XYOPEN : log(LOG_DEBUG, "request type \n"); status = srxyopen(s, &lun, &access,(bet?is_remote:0),(bet?from_host:NULL),bet); log(LOG_DEBUG, "xyopen(%d,%d) returned: %d\n",lun,access,status); break; case RQST_XYCLOS : log(LOG_DEBUG, "request type \n",lun); status = srxyclos(s, &info, lun); log(LOG_DEBUG,"xyclos() returned %d\n",status); shutdown(s,2); close(s); if (mode) return(0); else exit(0); case RQST_XYREAD : info.readop ++ ; log(LOG_DEBUG, "request type \n"); status = srxyread(s, &info, lun, access); log(LOG_DEBUG, "xyread() returned: %d\n",status); break; case RQST_XYWRIT : info.writop ++ ; log(LOG_DEBUG, "request type \n", lun, access); status = srxywrit(s, &info, lun, access); log(LOG_DEBUG, "xywrit() returned: %d\n",status); break; #endif /* FORTRAN */ case RQST_MSTAT64: case RQST_STAT64 : log(LOG_DEBUG, "request type \n"); status = srstat64(s, is_remote, from_host); log(LOG_DEBUG, "stat64() returned %d\n",status); if (request == RQST_STAT64) { #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ shutdown(s, 2); close(s); if(mode) return(0); else exit(0); } /* if request == RQST_STAT64 */ break ; #if !defined(_WIN32) case RQST_LSTAT64 : log(LOG_DEBUG, "request type \n"); status = srlstat64(s, is_remote, from_host); log(LOG_DEBUG, "lstat64() returned %d\n",status); shutdown(s,2); close(s); if (mode) return(0); else exit(0); break; #endif /* ! _WIN32 */ case RQST_STATFS64 : log(LOG_DEBUG, "request type \n"); status = srstatfs64(s) ; log(LOG_DEBUG, "statfs64() returned %d\n",status); #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ shutdown(s,2); close(s); if (mode) return(0); else exit(0); default : log(LOG_ERR, "unknown request type %x(hex)\n", request); #if defined(_WIN32) return(mt_cleanup(td, &fd, 0)); #endif /* WIN32 */ if (mode) return(0); else exit(0); break; } /* End of switch (request) */ } /* End of for (;;) */ } #if defined(_WIN32) static int set_rcv_sockparam(s, value) SOCKET s; int value; { if( setsockopt( s, SOL_SOCKET, SO_RCVBUF, (char*)&value, sizeof(value)) == SOCKET_ERROR) { if( WSAGetLastError() != WSAENOBUFS ) { log(LOG_ERR, "setsockopt rcvbuf(): %s\n", geterr()); WSACleanup(); exit(1); } else return(-1); } else return(value); } static int set_snd_sockparam(s, value) SOCKET s; int value; { if(setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char*)&value, sizeof(value)) == SOCKET_ERROR) { if( WSAGetLastError() != WSAENOBUFS ) { log(LOG_ERR, "setsockopt sndbuf(): %s\n", geterr()); WSACleanup(); exit(1); } else return(-1); } else return(value); } #else static int set_rcv_sockparam(s,value) int s,value; { if (setsockopt(s,SOL_SOCKET,SO_RCVBUF,(char *)&value, sizeof(value)) < 0) { if (errno != ENOBUFS) { log(LOG_ERR, "setsockopt rcvbuf(): %s\n",strerror(errno)); exit(1); } else return(-1); } /* else */ return(value); } static int set_snd_sockparam(s,value) int s,value; { if (setsockopt(s,SOL_SOCKET,SO_SNDBUF,(char *)&value, sizeof(value)) < 0) { if (errno != ENOBUFS) { log(LOG_ERR, "setsockopt sndbuf(): %s\n",strerror(errno)); exit(1); } else return(-1); } /* else */ return(value); } #endif #ifndef _WIN32 void check_child_exit() { int child_pid; int term_status; while ((child_pid = waitpid(-1, &term_status, WNOHANG)) > 0) { if (WIFEXITED(term_status)) { log(LOG_ERR,"Waiting for end of child %d, status %d\n", child_pid, WEXITSTATUS(term_status)); } else if (WIFSIGNALED(term_status)) { log(LOG_ERR,"Waiting for end of child %d, uncaught signal %d\n", child_pid, WTERMSIG(term_status)); } else { log(LOG_ERR,"Waiting for end of child %d, stopped\n", child_pid); } } } #endif get_client_actual_id (uid, gid, mech, auth_id, rt, mapping) uid_t *uid; gid_t *gid; char **mech; char **auth_id; int *rt; int *mapping; { #ifdef CSEC *uid = Csec_uid; *gid = Csec_gid; if (mech) *mech = Csec_mech; if (auth_id) *auth_id = Csec_auth_id; if (rt) *rt = 0; if (mapping) *mapping = 1; #endif return (0); } lcgdm-1.10.0/rfio/fopen.c0000644000175000017500000000272510222773541014442 0ustar ellertellert/* * $Id: fopen.c,v 1.1 2005/03/31 13:13:00 baud Exp $ */ /* * Copyright (C) 1990-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: fopen.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:00 $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy"; #endif /* not lint */ /* fopen.c Remote File I/O - open a binary file */ /* * System remote file I/O */ #define RFIO_KERNEL 1 #include #include "rfio.h" #include "rfio_rfilefdt.h" /* * Remote file open */ RFILE DLL_DECL *rfio_fopen(file, mode) char * file ; char * mode ; { register int f, rw, oflags ; int f_index; INIT_TRACE("RFIO_TRACE") ; TRACE(1, "rfio", "rfio_fopen(%s, %s)", file, mode) ; if (mode[1] == 'b') rw= ( mode[2] == '+' ) ; else rw= ( mode[1] == '+' ) ; switch(*mode) { case 'a': oflags= O_APPEND | O_CREAT | ( rw ? O_RDWR : O_WRONLY ) ; break ; case 'r': oflags= rw ? O_RDWR : O_RDONLY ; break ; case 'w': oflags= O_TRUNC | O_CREAT | ( rw ? O_RDWR : O_WRONLY ) ; break ; default: END_TRACE() ; return NULL ; } f= rfio_open(file,oflags, 0666) ; if ( f < 0 ) { END_TRACE() ; return NULL ; } if ( (f_index = rfio_rfilefdt_findentry(f,FINDRFILE_WITHOUT_SCAN)) != -1 ) { END_TRACE() ; return (RFILE *) rfilefdt[f_index] ; } else { TRACE(3,"rfio","rfio_fopen() : Using local FILE ptr "); END_TRACE() ; rfio_errno = 0; return (RFILE *) fdopen(f,mode); } } lcgdm-1.10.0/rfio/rfio_statfs64.man0000644000175000017500000000021510313775555016361 0ustar ellertellert.so ./rfio_statfs.man .\" @(#)$RCSfile: rfio_statfs64.man,v $ $Revision: 1.1 $ $Date: 2005/09/20 12:07:09 $ CERN IT-GD/SC Jean-Philippe Baud lcgdm-1.10.0/rfio/rfio_opendir.man0000644000175000017500000000405110222773541016335 0ustar ellertellert.\" .\" $Id: rfio_opendir.man,v 1.1 2005/03/31 13:13:03 baud Exp $ .\" .\" @(#)$RCSfile: rfio_opendir.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2001 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_OPENDIR 3 "$Date: 2005/03/31 13:13:03 $" CASTOR "Rfio Library Functions" .SH NAME rfio_opendir \- open a directory .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "RDIR *rfio_opendir (const char *" path ");" .SH DESCRIPTION .B rfio_opendir opens a directory to be used in subsequent .B rfio_readdir operations. A .B RDIR structure and a buffer to cache the directory entries are allocated in the client API. .TP .I path specifies the logical pathname relative to the current directory or the full pathname. .SH NOTES For CASTOR directories, a multi-threaded application will need to initialize itself the Cthread (CASTOR Thread Interface) library ; this is done by including "shift/Cthread_api.h" and calling the function Cthread_init() at the beginning. Otherwise accessing CASTOR directories will not be thread-safe. See \fBCthread\fP(3). .SH RETURN VALUE This routine returns a pointer to be used in the subsequent directory function calls if the operation was successful or NULL if the operation failed. In the latter case, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B ENOENT A component of .I path prefix does not exist or .I path is a null pathname. .TP .B EACCES Search permission is denied on a component of the .I path prefix or read permission is denied on .IR path . .TP .B EFAULT .I path is a NULL pointer. .TP .B ENOTDIR A component of .I path prefix is not a directory. .TP .B ENAMETOOLONG The length of .I path exceeds .B CA_MAXPATHLEN or the length of a .I path component exceeds .BR CA_MAXNAMELEN . .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR Castor_limits(4) , .BR rfio_closedir(3) , .BR rfio_readdir(3) , .BR rfio_rewinddir(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_call64.c0000644000175000017500000032742112245655020015440 0ustar ellertellert/* * Copyright (C) 1990-2010 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rfio_call64.c,v $ $Revision: 9755 $ $Date: 2013-11-28 15:58:24 +0100 (Thu, 28 Nov 2013) $ CERN/IT/PDP/DM Frederic Hemmer, Philippe Gaillardon"; #endif /* not lint */ /* * Remote file I/O flags and declarations. */ #define DEBUG 0 #define RFIO_KERNEL 1 #include #include #include #include #include #if defined(_WIN32) #include "syslog.h" #else #include #include /* System logger */ #include #endif #if defined(_AIX) || defined(hpux) || defined(SOLARIS) || defined(linux) #include #endif #include #include "rfio.h" #include "rfio_server.h" #include "rfcntl.h" #include "log.h" #include "net.h" #include "u64subr.h" #if defined(_AIX) #include #endif #include #if !defined(_WIN32) #include #if ((defined(IRIX5) || defined(IRIX6)) && ! (defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN) && defined(PDP_ENDIAN))) #ifdef LITTLE_ENDIAN #undef LITTLE_ENDIAN #endif #define LITTLE_ENDIAN 1234 #ifdef BIG_ENDIAN #undef BIG_ENDIAN #endif #define BIG_ENDIAN 4321 #ifdef PDP_ENDIAN #undef PDP_ENDIAN #endif #define PDP_ENDIAN 3412 #endif #include #endif #include #ifdef linux #include #endif #include /* For multithreading stuff, only tested under Linux at present */ #include #include "Csemaphore.h" /* If daemonv3_rdmt is true, reading from disk will be multithreaded The circular buffer will have in this case daemonv3_rdmt_nbuf buffers of size daemonv3_rdmt_bufsize. See defaults in rfio_server.h */ static int daemonv3_rdmt, daemonv3_rdmt_nbuf, daemonv3_rdmt_bufsize; /* If daemonv3_wrmt is true, reading from disk will be multithreaded The circular buffer will have in this case daemonv3_wrmt_nbuf buffers of size daemonv3_wrmt_bufsize. See defaults in rfio_server.h */ static int daemonv3_wrmt, daemonv3_wrmt_nbuf, daemonv3_wrmt_bufsize; /* The circular buffer definition */ static struct element { char *p; int len; } *array = NULL; /* The two semaphores to synchonize accesses to the circular buffer */ CSemaphore empty64, full64; /* Number of buffers produced and consumed */ int produced64 = 0; int consumed64 = 0; /* Variable used for error reporting between disk writer thread and main thread reading from the network */ static int write_error; /* Variable set by the main thread reading from the network to tell the disk reader thread to stop */ static volatile int stop_read; extern char *getconfent() ; extern int checkkey(int sock, u_short key ); extern int chsuser(int uid, int gid, char *hostname, int *ptrcode, char *permstr) ; extern struct passwd stagersuperuser; #if defined(_WIN32) #if !defined (MAX_THREADS) #define MAX_THREADS 64 #endif /* MAX_THREADS */ extern DWORD tls_i; /* thread local storage index */ extern struct thData { SOCKET ns; /* control socket */ struct sockaddr_storage from; int fromlen; int mode; int _is_remote; int fd; /* all globals, which have to be local for thread */ char *rqstbuf; /* Request buffer */ char *filename; /* file name */ char *iobuffer; /* Data communication buffer */ int iobufsiz; /* Current io buffer size */ SOCKET data_s; /* Data listen socket (v3) */ SOCKET data_sock; /* Data accept socket (v3) */ SOCKET ctrl_sock; /* the control socket (v3) */ int first_write; int first_read; int byte_read_from_network; struct rfiostat myinfo; char from_host[MAXHOSTNAMELEN]; /* Context for the open/firstwrite/close handlers */ void *handler_context; } *td; #define rqstbuf td->rqstbuf #define filename td->filename #define iobuffer td->iobuffer #define iobufsiz td->iobufsiz #define data_s td->data_s #define data_sock td->data_sock #define ctrl_sock td->ctrl_sock #define first_write td->first_write #define first_read td->first_read #define byte_read_from_network td->byte_read_from_network #define is_remote td->_is_remote #define myinfo td->myinfo #define handler_context td->handler_context #else /* WIN32 */ /* * Buffer declarations */ extern char rqstbuf[BUFSIZ] ; /* Request buffer */ extern char filename[MAXFILENAMSIZE]; static char *iobuffer ; /* Data communication buffer */ static int iobufsiz; /* Current io buffer size */ /* Context for the open/firstwrite/close handlers */ static void *handler_context; #endif /* else WIN32 */ #if defined(_WIN32) #define ECONNRESET WSAECONNRESET #endif /* WIN32 */ extern int srchkreqsize _PROTO((SOCKET, char *, int)); /************************************************************************/ /* */ /* IO HANDLERS */ /* */ /************************************************************************/ #if !defined(_WIN32) int srlockf64(s, infop, fd) int s; struct rfiostat *infop; int fd; { char *p ; LONG status = 0; LONG len ; LONG mode ; int op; off64_t siz; int rcode = 0 ; LONG how; off64_t offset; off64_t offsetout; char tmpbuf[21]; p = rqstbuf + (2*WORDSIZE) ; unmarshall_LONG(p, how) ; unmarshall_LONG(p, len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { log(LOG_DEBUG, "srlockf64(%d,%d): reading %d bytes\n", s, fd, len); serrno = 0; if (netread_timeout(s, rqstbuf, len, RFIO_CTRL_TIMEOUT) != len) { log(LOG_ERR, "srlockf64: read(): %s\n", neterror()); return -1; } /* * Reading request. */ p = rqstbuf ; unmarshall_LONG(p, op) ; unmarshall_HYPER(p, siz); unmarshall_HYPER(p, offset); log(LOG_DEBUG, "srlockf64(%d,%d): operation %d, size %s\n", s, fd, op, u64tostr(siz,tmpbuf,0)); infop->lockop++; /* * lseek() if needed. */ if ( how != -1 ) { log(LOG_DEBUG, "lseek64(%d,%d): lseek64(%d,%s,%d)\n", s, fd, fd, u64tostr(offset,tmpbuf,0), how) ; infop->seekop++; if ( (offsetout= lseek64(fd,offset,how)) == -1 ) { rcode= errno ; status = -1; log(LOG_ERR, "srlockf64(%d,%d): error %d in lseek64\n", s, fd, rcode); } } if (status == 0 ) { if ( (status = lockf64(fd, op, siz)) < 0 ) { rcode = errno ; log(LOG_ERR, "srlockf64(%d,%d): error %d in lockf64(%d,%d,%s)\n", s, fd, rcode, fd, op, u64tostr(siz,tmpbuf,0)); } else status = 0 ; } } p = rqstbuf ; marshall_LONG(p, status); marshall_LONG(p, rcode); #if defined(SACCT) rfioacct(RQST_LOCKF,-1,-1,s,op,(int)siz,status,rcode,NULL,NULL,NULL); #endif /* SACCT */ log(LOG_DEBUG, "srlockf64: sending back status %d rcode %d\n", status, rcode); serrno = 0; if (netwrite_timeout(s, rqstbuf, 2*LONGSIZE, RFIO_CTRL_TIMEOUT) != (2*LONGSIZE)) { log(LOG_ERR, "srlockf64: write(): %s\n", neterror()); return -1 ; } return status ; } #endif /* !WIN32 */ #if !defined(_WIN32) int srlstat64(s, rt, host) int s; int rt; /* Is it a remote site call ? */ char *host; /* Where the request comes from */ { char *auth_id; char *mech; int need_user_check = 1; char * p ; int status = 0, rcode = 0 ; int len ; int replen; struct stat64 statbuf ; char user[CA_MAXUSRNAMELEN+1]; int uid,gid; p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p,len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { /* * Reading stat request. */ log(LOG_DEBUG, "srlstat64(%d): reading %d bytes\n", s, len); serrno = 0; if ((status = netread_timeout(s,rqstbuf,len,RFIO_CTRL_TIMEOUT)) != len) { log(LOG_ERR, "srlstat64: read(): %s\n", neterror()); return -1; } p= rqstbuf ; uid = gid = 0; status = 0; *user = *filename = '\0'; unmarshall_WORD(p,uid); unmarshall_WORD(p,gid); get_client_actual_id(&uid, &gid, &mech, &auth_id, &rt, NULL); if (unmarshall_STRINGN(p, user, CA_MAXUSRNAMELEN+1) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } if (unmarshall_STRINGN(p, filename, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } if ( (status == 0) && rt ) { char to[100]; int rcd; int to_uid, to_gid ; if ( (rcd = get_user(host,user,uid,gid,to,&to_uid,&to_gid)) == -ENOENT ) { log(LOG_ERR, "srlstat64: get_user(): Error opening mapping file\n") ; status= -1; errno = EINVAL; rcode = errno ; } if ( !status && abs(rcd) == 1 ) { log(LOG_ERR, "srlstat64: No entry in mapping file for (%s,%s,%d,%d)\n", host, user, uid, gid); status= -1; errno=EACCES; rcode=errno; } else { log(LOG_DEBUG, "srlstat64: (%s,%s,%d,%d) mapped to %s(%d,%d)\n", host, user, uid, gid, to, to_uid, to_gid) ; uid = to_uid ; gid = to_gid ; } } if ( !status ) { status = rfio_handle_stat64(filename, 1, mech, auth_id, uid, gid, &statbuf, &need_user_check); if (status < 0) { char alarmbuf[1024]; rcode = serrno; sprintf(alarmbuf,"srlstat64(): %s",filename) ; log(LOG_DEBUG, "srlstat64: rfio_handler_stat refused stat: %s\n", sstrerror(serrno)) ; rfio_alrm(rcode,alarmbuf) ; memset(&statbuf,'\0',sizeof(statbuf)); } } if ( !status && need_user_check) { if ( (status=chsuser(uid,gid,host,&rcode,"FTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"WTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"XTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"OPENTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"STATTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"POPENTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"LINKTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"CHMODTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"CHOWNTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"MKDIRTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RMDIRTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RENAMETRUST")) < 0 ) { if (status == -2) log(LOG_ERR, "srlstat64: uid %d not allowed to stat()\n", uid); else log(LOG_ERR, "srlstat64: failed at chsuser(), rcode %d\n", rcode); memset(&statbuf,'\0',sizeof(statbuf)); status = rcode ; } else { status= ( lstat64(filename, &statbuf) < 0 ) ? errno : 0 ; log(LOG_INFO, "srlstat64: file: %s , status %d\n", filename, status) ; } } } p = rqstbuf ; marshall_WORD(p, statbuf.st_dev); marshall_HYPER(p, statbuf.st_ino); marshall_WORD(p, statbuf.st_mode); marshall_WORD(p, statbuf.st_nlink); marshall_WORD(p, statbuf.st_uid); marshall_WORD(p, statbuf.st_gid); marshall_HYPER(p, statbuf.st_size); marshall_LONG(p, statbuf.st_atime); marshall_LONG(p, statbuf.st_mtime); marshall_LONG(p, statbuf.st_ctime); /* * Bug #2646. This is one of the rare cases when the errno * is returned in the status parameter. */ if ( status == -1 && rcode > 0 ) status = rcode; marshall_LONG(p, status); marshall_LONG(p, statbuf.st_blksize); marshall_HYPER(p, statbuf.st_blocks); replen = 3*HYPERSIZE+5*LONGSIZE+5*WORDSIZE; log(LOG_DEBUG, "srlstat64: sending back %d\n", status); serrno = 0; if (netwrite_timeout(s,rqstbuf, replen, RFIO_CTRL_TIMEOUT) != replen) { log(LOG_ERR, "srlstat64: write(): %s\n", neterror()); return -1 ; } return 0 ; } #endif /* !WIN32 */ int srstat64(s, rt, host) SOCKET s; int rt; /* Is it a remote site call ? */ char *host; /* Where the request comes from */ { char *auth_id; char *mech; int need_user_check = 1; char *p ; int status = 0, rcode = 0 ; int len ; int replen; struct stat64 statbuf ; char user[CA_MAXUSRNAMELEN+1]; int uid,gid; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p,len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { /* * Reading stat request. */ log(LOG_DEBUG, "srstat64(%d): reading %d bytes\n", s, len); serrno = 0; if ((status = netread_timeout(s,rqstbuf,len,RFIO_CTRL_TIMEOUT)) != len) { log(LOG_ERR, "srstat64: read(): %s\n", neterror()); return -1; } p = rqstbuf ; uid = gid = 0; status = 0; *user = *filename = '\0'; unmarshall_WORD(p,uid); unmarshall_WORD(p,gid); get_client_actual_id(&uid, &gid, &mech, &auth_id, &rt, NULL); if (unmarshall_STRINGN(p, user, CA_MAXUSRNAMELEN+1) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } if (unmarshall_STRINGN(p, filename, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } if ( (status == 0) && rt ) { char to[100]; int rcd; int to_uid, to_gid ; if ( (rcd = get_user(host,user,uid,gid,to,&to_uid,&to_gid)) == -ENOENT ) { log(LOG_ERR, "srstat64: get_user(): Error opening mapping file\n") ; status= -1; errno = EINVAL; rcode = errno ; } if ( !status && abs(rcd) == 1 ) { log(LOG_ERR, "srstat64: No entry in mapping file for (%s,%s,%d,%d)\n", host, user, uid, gid); status= -1; errno=EACCES; rcode=errno; } else { log(LOG_DEBUG, "srstat64: (%s,%s,%d,%d) mapped to %s(%d,%d)\n", host, user, uid, gid, to, to_uid, to_gid) ; uid = to_uid ; gid = to_gid ; } } if ( !status ) { status = rfio_handle_stat64(filename, 0, mech, auth_id, uid, gid, &statbuf, &need_user_check); if (status < 0) { char alarmbuf[1024]; rcode = serrno; sprintf(alarmbuf,"srstat64(): %s",filename) ; log(LOG_DEBUG, "srstat64: rfio_handler_stat refused stat: %s\n", sstrerror(serrno)) ; rfio_alrm(rcode,alarmbuf) ; memset(&statbuf,'\0',sizeof(statbuf)); } } if ( !status && need_user_check) { /* * Trust root for stat() if trusted for any other privileged operation */ rcode = 0; if ( (status=chsuser(uid,gid,host,&rcode,"FTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"WTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"XTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"OPENTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"STATTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"POPENTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"LINKTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"CHMODTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"CHOWNTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"MKDIRTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RMDIRTRUST")) < 0 && (status=chsuser(uid,gid,host,&rcode,"RENAMETRUST")) < 0 ) { if (status == -2) log(LOG_ERR, "srstat64: uid %d not allowed to stat()\n", uid); else log(LOG_ERR, "srstat64: failed at chsuser(), rcode %d\n", rcode); memset(&statbuf,'\0',sizeof(statbuf)); status = rcode ; } else { status= ( stat64(filename, &statbuf) < 0 ) ? errno : 0 ; log(LOG_INFO, "srstat64: file: %s for (%d,%d) status %d\n", filename, uid, gid, status) ; } } } p = rqstbuf ; marshall_WORD(p, statbuf.st_dev); marshall_HYPER(p, statbuf.st_ino); marshall_WORD(p, statbuf.st_mode); marshall_WORD(p, statbuf.st_nlink); marshall_WORD(p, statbuf.st_uid); marshall_WORD(p, statbuf.st_gid); marshall_HYPER(p, statbuf.st_size); marshall_LONG(p, statbuf.st_atime); marshall_LONG(p, statbuf.st_mtime); marshall_LONG(p, statbuf.st_ctime); /* * Bug #2646. This is one of the rare cases when the errno * is returned in the status parameter. */ if ( status == -1 && rcode > 0 ) status = rcode; marshall_LONG(p, status); #if !defined(_WIN32) marshall_LONG(p, statbuf.st_blksize); marshall_HYPER(p, statbuf.st_blocks); #endif replen = 3*HYPERSIZE+5*LONGSIZE+5*WORDSIZE; serrno = 0; if (netwrite_timeout(s, rqstbuf, replen, RFIO_CTRL_TIMEOUT) != replen) { log(LOG_ERR, "srstat64: write(): %s\n", neterror()); return -1 ; } return 0 ; } int srstatfs64(s) int s; { int status = 0 ; int rcode = 0; int len ; char *p ; char path[MAXFILENAMSIZE] ; struct rfstatfs64 statfsbuf ; int uid, gid; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif memset(&statfsbuf, 0, sizeof(struct rfstatfs64)); p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p,len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { log(LOG_DEBUG,"srstatfs64(): reading %d bytes\n",len) ; serrno = 0; if ((status = netread_timeout(s,rqstbuf,len,RFIO_CTRL_TIMEOUT)) != len) { log(LOG_ERR,"srstatfs64(): read(): %s\n", neterror()); return -1; } p= rqstbuf ; status = 0; *path = '\0'; if (unmarshall_STRINGN(p, path, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } get_client_actual_id(&uid, &gid, NULL, NULL, NULL, NULL); if ( !status && (uid == -1 || gid == -1)) { status = -1; rcode = EACCES; } if ( !status ) { status = rfstatfs64(path,&statfsbuf) ; rcode = errno ; log(LOG_INFO,"srstatfs64: path : %s , status %d\n",path,status ) ; } /* * Shipping the results */ } p = rqstbuf ; marshall_LONG( p, statfsbuf.bsize ) ; marshall_HYPER( p, statfsbuf.totblks ) ; marshall_HYPER( p, statfsbuf.freeblks ) ; marshall_HYPER( p, statfsbuf.totnods ) ; marshall_HYPER( p, statfsbuf.freenods ) ; marshall_LONG( p, status ) ; marshall_LONG( p, rcode ) ; log(LOG_DEBUG, "srstatfs64: sending back %d\n", status); serrno = 0; if (netwrite_timeout(s,rqstbuf,3*LONGSIZE+4*HYPERSIZE,RFIO_CTRL_TIMEOUT) != (3*LONGSIZE+4*HYPERSIZE)) { log(LOG_ERR, "srstatfs64: netwrite_timeout(): %s\n", neterror()); return -1 ; } return status ; } int sropen64(s, rt, host) SOCKET s; int rt; /* Is it a remote site call ? */ char *host; /* Where the request comes from */ { char *auth_id; char *mech; int status; int rcode = 0; char *p; int len; int replen; int fd ; LONG flags, mode; int uid,gid; WORD mask, ftype, passwd, mapping; char account[MAXACCTSIZE]; /* account string */ char user[CA_MAXUSRNAMELEN+1]; /* User name */ char reqhost[MAXHOSTNAMELEN]; off64_t offsetin, offsetout; SOCKET sock; char tmpbuf[21], tmpbuf2[21]; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p = rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p, len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { /* * Reading open request. */ log(LOG_DEBUG, "sropen64(%d): reading %d bytes\n", s, len) ; serrno = 0; if ((status = netread_timeout(s,rqstbuf,len,RFIO_CTRL_TIMEOUT)) != len) { log(LOG_ERR, "sropen64: read(): %s\n", neterror()); return -1 ; } p = rqstbuf ; status = 0; *account = *filename = *user = *reqhost = '\0'; unmarshall_WORD(p, uid); unmarshall_WORD(p, gid); unmarshall_WORD(p, mask); unmarshall_WORD(p, ftype); unmarshall_LONG(p, flags); unmarshall_LONG(p, mode); if (unmarshall_STRINGN(p, account, MAXACCTSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } if (unmarshall_STRINGN(p, filename, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } if (unmarshall_STRINGN(p, user, CA_MAXUSRNAMELEN+1) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } if (unmarshall_STRINGN(p, reqhost, MAXHOSTNAMELEN) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } unmarshall_LONG(p, passwd); unmarshall_WORD(p, mapping); get_client_actual_id(&uid, &gid, &mech, &auth_id, &rt, &mapping); log(LOG_DEBUG, "sropen64: Opening file %s for remote user: %s\n", filename, user); if (rt) log(LOG_DEBUG, "sropen64: Mapping : %s\n", mapping ? "yes" : "no" ); if (rt && !mapping) { log(LOG_DEBUG, "sropen64: name : %d, uid: %d, gid: %d\n", passwd, uid, gid); } /* * Someone in the site has tried to specify (uid,gid) directly ! */ if ( (status == 0) && !mapping && !rt) { log(LOG_INFO, "sropen64: attempt to make non-mapped I/O and modify uid or gid !\n"); errno=EACCES ; rcode=errno ; status= -1 ; } if ( (status == 0) && rt ) { openlog("rfio", LOG_PID, LOG_USER); syslog(LOG_ALERT, "sropen64: connection %s mapping by %s(%d,%d) from %s", (mapping ? "with" : "without"), user, uid, gid, host) ; closelog() ; } /* * MAPPED mode: user will be mapped to user "to" */ if ( !status && rt && mapping ) { char to[100]; int rcd,to_uid,to_gid; log(LOG_DEBUG, "sropen64: Mapping (%s, %d, %d) \n", user, uid, gid ); if ( (rcd = get_user(host,user,uid,gid,to,&to_uid,&to_gid)) == -ENOENT ) { log(LOG_ERR, "sropen64: get_user() error opening mapping file\n") ; status = -1; errno = EINVAL; rcode = SEHOSTREFUSED ; } else if ( abs(rcd) == 1 ) { log(LOG_ERR, "sropen64: No entry found in mapping file for (%s,%s,%d,%d)\n", host,user,uid,gid); status = -1; errno = EACCES; rcode = SEHOSTREFUSED; } else { log(LOG_DEBUG, "sropen64: (%s,%s,%d,%d) mapped to %s(%d,%d)\n", host, user, uid, gid, to, to_uid, to_gid) ; uid = to_uid ; gid = to_gid ; if ( uid < 100 || gid < 100 ) { errno = EACCES; status = -1; rcode = SEHOSTREFUSED; } } } /* * DIRECT access: the user specifies uid & gid by himself */ if ( !status && rt && !mapping ){ char * rtuser; if ( (rtuser=getconfent ("RTUSER","CHECK",0) ) == NULL || ! strcmp (rtuser,"YES") ) { /* Port is also passwd */ #if defined(_WIN32) if( (sock = connecttpread(reqhost, passwd)) != INVALID_SOCKET && !checkkey(sock, passwd) ) #else if( (sock = connecttpread(reqhost, passwd)) >= 0 && !checkkey(sock, passwd) ) #endif { status= -1 ; errno = EACCES; rcode= errno ; log(LOG_ERR, "sropen64: DIRECT mapping : permission denied\n"); } #if defined(_WIN32) if( sock == INVALID_SOCKET ) #else if( sock < 0 ) #endif { status= -1 ; log(LOG_ERR, "sropen64: DIRECT mapping failed: Couldn't connect %s\n", reqhost); rcode = EACCES; } } else log(LOG_INFO, "sropen64: Any DIRECT rfio request from out of site is authorized\n"); } if ( !status ) { char *pfn = NULL; int need_user_check = 1; log(LOG_DEBUG, "sropen64: uid %d gid %d mask %o ftype %d flags 0%o mode 0%o\n", uid, gid, mask, ftype, flags, mode); log(LOG_DEBUG, "sropen64: account: %s\n", account); log(LOG_INFO, "sropen64: (%s,0%o,0%o) for (%d,%d)\n", filename, flags, mode, uid, gid); status = rfio_handle_open(filename, ntohopnflg(flags), mode, mech, auth_id, uid, gid, &pfn, &handler_context, &need_user_check); if (status < 0) { char alarmbuf[1024]; rcode = serrno; sprintf(alarmbuf,"sropen(): %s",filename) ; log(LOG_DEBUG, "sropen: rfio_handler_open refused open: %s\n", sstrerror(serrno)) ; rfio_alrm(rcode,alarmbuf) ; } if (! status && need_user_check && ((status=chsuser(uid,gid,host,&rcode,((ntohopnflg(flags) & (O_WRONLY|O_RDWR)) != 0) ? "WTRUST" : "RTRUST")) < 0) && ((status=chsuser(uid,gid,host,&rcode,"OPENTRUST")) < 0) ) { if (status == -2) log(LOG_ERR, "sropen64: uid %d not allowed to open64()\n", uid); else log(LOG_ERR, "sropen64: failed at chsuser(), rcode %d\n", rcode); status = -1 ; } if (! status) { if (! need_user_check) { /* managed file */ mode = 0660; (void) umask(0) ; } else (void) umask(mask) ; errno = 0; fd = open64(filename, ntohopnflg(flags), mode) ; log(LOG_DEBUG, "sropen64: open64(%s,0%o,0%o) returned %x (hex)\n", filename, flags, mode, fd); if (fd < 0) { char alarmbuf[1024]; sprintf(alarmbuf,"sropen64: %s", filename) ; status= -1 ; rcode= errno ; log(LOG_DEBUG, "sropen64: open64: %s\n", strerror(errno)) ; rfio_alrm(rcode,alarmbuf) ; } else { if (! need_user_check && (ntohopnflg(flags) & O_CREAT)) /* new managed file */ chown(filename, stagersuperuser.pw_uid, stagersuperuser.pw_gid); /* * Getting current offset */ offsetin = 0; errno = 0; offsetout= lseek64(fd, offsetin, SEEK_CUR) ; log(LOG_DEBUG, "sropen64: lseek64(%d,%s,SEEK_CUR) returned %s\n", fd, u64tostr(offsetin,tmpbuf,0), u64tostr(offsetout,tmpbuf2,0)) ; if ( offsetout < 0 ) { rcode = errno ; status = -1; } else status = 0; } } if (pfn != NULL) free(pfn); } } /* * Sending back status. */ p= rqstbuf ; marshall_WORD(p,RQST_OPEN64) ; marshall_LONG(p,status); marshall_LONG(p,rcode) ; marshall_LONG(p,0) ; marshall_HYPER(p,offsetout) ; #if defined(SACCT) rfioacct(RQST_OPEN64,uid,gid,s,(int)ntohopnflg(flags),(int)mode,status,rcode,NULL,filename,NULL); #endif /* SACCT */ log(LOG_DEBUG, "sropen64: sending back status(%d) and errno(%d)\n", status, rcode); replen = WORDSIZE+3*LONGSIZE+HYPERSIZE; serrno = 0; if (netwrite_timeout(s,rqstbuf,replen,RFIO_CTRL_TIMEOUT) != replen) { log(LOG_ERR, "sropen64: write(): %s\n", neterror()); return -1 ; } return fd ; } int srwrite64(s, infop, fd) SOCKET s; int fd; struct rfiostat * infop ; { int status; /* Return code */ int rcode; /* To send back errno */ int how; /* lseek mode */ off64_t offset; /* lseek offset */ off64_t offsetout; /* lseek offset */ int size; /* Requeste write size */ char *p; /* Pointer to buffer */ int reqlen; /* residual request len */ int replen=WORDSIZE+3*LONGSIZE; /* Reply buffer length */ char tmpbuf[21]; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p, size); unmarshall_LONG(p, how) ; /* * Receiving request: we have 4 bytes more to be read */ p= rqstbuf + RQSTSIZE ; reqlen = HYPERSIZE; log(LOG_DEBUG, "srwrite64(%d, %d)): reading %d bytes\n", s, fd, reqlen) ; serrno = 0; if ((status = netread_timeout(s, p, reqlen, RFIO_CTRL_TIMEOUT)) != reqlen) { log(LOG_ERR, "srwrite64: read(): %s\n", neterror()); return -1 ; } unmarshall_HYPER(p,offset) ; log(LOG_DEBUG, "srwrite64(%d, %d): size %d, how %d offset %s\n", s, fd, size, how, u64tostr(offset,tmpbuf,0)); /* * Checking if buffer is large enough. */ if (iobufsiz < size) { int optval ; /* setsockopt opt value */ if (iobufsiz > 0) { log(LOG_DEBUG, "srwrite64: freeing %x\n", iobuffer); (void) free(iobuffer) ; } if ((iobuffer = malloc(size)) == NULL) { status= -1 ; rcode= errno ; p= rqstbuf ; marshall_WORD(p,RQST_WRITE64) ; marshall_LONG(p,status) ; marshall_LONG(p,rcode) ; marshall_LONG(p,0) ; log(LOG_ERR, "srwrite64: malloc(): %s\n", strerror(errno)) ; serrno = 0; if ( netwrite_timeout(s,rqstbuf,replen,RFIO_CTRL_TIMEOUT) != replen ) { log(LOG_ERR, "srwrite64: netwrite(): %s\n", neterror()); return -1 ; } return -1 ; } iobufsiz = size ; optval = (iobufsiz > 64 * 1024) ? iobufsiz : (64 * 1024); log(LOG_DEBUG, "srwrite64: allocated %d bytes at %x\n", size, iobuffer) ; serrno = 0; if( setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char*)&optval, sizeof(optval)) == SOCKET_ERROR ) log(LOG_ERR, "srwrite64: setsockopt(SO_RCVBUF): %s\n", neterror()); else log(LOG_DEBUG, "srwrite64: setsockopt(SO_RCVBUF): %d\n", optval) ; } /* * Reading data on the network. */ p= iobuffer; serrno = 0; if (netread_timeout(s,p,size,RFIO_DATA_TIMEOUT) != size) { log(LOG_ERR, "srwrite64: read(): %s\n", neterror()); return -1 ; } /* * lseek() if needed. */ if ( how != -1 ) { log(LOG_DEBUG, "srwrite64(%d,%d): lseek64(%d,%s,%d)\n", s, fd, fd, u64tostr(offset,tmpbuf,0), how) ; infop->seekop++; if ( (offsetout = lseek64(fd,offset,how)) == -1 ) { rcode= errno ; status = -1; p= rqstbuf ; marshall_WORD(p,RQST_WRITE64) ; marshall_LONG(p,status) ; marshall_LONG(p,rcode) ; marshall_LONG(p,0) ; serrno = 0; if ( netwrite_timeout(s,rqstbuf,replen,RFIO_CTRL_TIMEOUT) != replen ) { log(LOG_ERR, "srwrite64: netwrite(): %s\n", neterror()); return -1 ; } return -1 ; } } /* * Writing data on disk. */ infop->wnbr+= size ; log(LOG_DEBUG, "srwrite64: writing %d bytes on %d\n", size, fd); status = write(fd,p,size) ; rcode= ( status < 0 ) ? errno : 0 ; if ( status < 0 ) { char alarmbuf[1024]; sprintf(alarmbuf,"srwrite64(): %s",filename) ; rfio_alrm(rcode,alarmbuf) ; } p = rqstbuf; marshall_WORD(p,RQST_WRITE64) ; marshall_LONG(p,status) ; marshall_LONG(p,rcode) ; marshall_LONG(p,0) ; log(LOG_DEBUG, "srwrite64: status %d, rcode %d\n", status, rcode) ; serrno = 0; if (netwrite_timeout(s,rqstbuf,replen,RFIO_CTRL_TIMEOUT) != replen) { log(LOG_ERR, "srwrite64: write(): %s\n", neterror()); return -1 ; } return status ; } int srread64(s, infop, fd) SOCKET s; int fd; struct rfiostat * infop ; { int status ; /* Return code */ int rcode ; /* To send back errno */ int how ; /* lseek mode */ off64_t offset ; /* lseek offset */ off64_t offsetout ; /* lseek offset */ int size ; /* Requested read size */ char *p ; /* Pointer to buffer */ int msgsiz ; /* Message size */ int reqlen; /* residual request length */ int replen=WORDSIZE+3*LONGSIZE; /* Reply header length */ char tmpbuf[21]; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p, size) ; unmarshall_LONG(p,how) ; /* * Receiving request: we have 8 bytes more to read */ p= rqstbuf + RQSTSIZE ; reqlen = HYPERSIZE; log(LOG_DEBUG, "srread64(%d, %d): reading %d bytes\n", s, fd, reqlen) ; serrno = 0; if ((status = netread_timeout(s, p , reqlen, RFIO_CTRL_TIMEOUT)) != reqlen) { log(LOG_ERR, "srread64: read(): %s\n", neterror()); return -1 ; } unmarshall_HYPER(p,offset) ; /* * lseek() if needed. */ if ( how != -1 ) { log(LOG_DEBUG, "srread64(%d,%d): lseek64(%d,%s,%d)\n", s, fd, fd, u64tostr(offset,tmpbuf,0), how) ; infop->seekop++; if ( (offsetout= lseek64(fd,offset,how)) == -1 ) { rcode= errno ; status = -1; p= rqstbuf ; marshall_WORD(p,RQST_READ64) ; marshall_LONG(p,status) ; marshall_LONG(p,rcode) ; marshall_LONG(p,0) ; serrno = 0; if ( netwrite_timeout(s,rqstbuf,replen,RFIO_CTRL_TIMEOUT) != replen ) { log(LOG_ERR, "srread64: write(): %s\n", neterror()); return -1 ; } return -1 ; } } /* * Allocating buffer if not large enough. */ log(LOG_DEBUG, "srread64(%d, %d): checking buffer size %d\n", s, fd, size); if (iobufsiz < (size+replen)) { int optval ; /* setsockopt opt value */ if (iobufsiz > 0) { log(LOG_DEBUG, "srread64: freeing %x\n", iobuffer); (void) free(iobuffer); } if ((iobuffer = malloc(size+replen)) == NULL) { status= -1 ; rcode= errno ; log(LOG_ERR, "srread64: malloc(): %s\n", strerror(errno)) ; p= rqstbuf ; marshall_WORD(p,RQST_READ64) ; marshall_LONG(p,status) ; marshall_LONG(p,rcode) ; marshall_LONG(p,0) ; serrno = 0; if ( netwrite_timeout(s,rqstbuf,replen,RFIO_CTRL_TIMEOUT) != replen ) { log(LOG_ERR, "srread64: netwrite(): %s\n", neterror()); return -1 ; } return -1 ; } iobufsiz = size + replen ; log(LOG_DEBUG, "srread64: allocated %d bytes at %x\n", size, iobuffer); optval = (iobufsiz > 64 * 1024) ? iobufsiz : (64 * 1024); serrno = 0; if( setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char*)&optval, sizeof(optval)) == SOCKET_ERROR ) log(LOG_ERR, "srread64: setsockopt(SO_SNDBUF): %s\n", neterror()); else log(LOG_DEBUG, "srread64: setsockopt(SO_SNDBUF): %d\n", optval); } p = iobuffer + replen; status = read(fd, p, size) ; if ( status < 0 ) { char alarmbuf[1024]; sprintf(alarmbuf,"srread64(): %s",filename) ; rcode= errno ; msgsiz= replen ; rfio_alrm(rcode,alarmbuf) ; } else { rcode= 0 ; infop->rnbr+= status ; msgsiz= status+replen ; } p= iobuffer ; marshall_WORD(p,RQST_READ64) ; marshall_LONG(p,status) ; marshall_LONG(p,rcode) ; marshall_LONG(p,status) ; log(LOG_DEBUG, "srread64: returning status %d, rcode %d\n", status, rcode) ; serrno = 0; if (netwrite_timeout(s,iobuffer,msgsiz,RFIO_CTRL_TIMEOUT) != msgsiz) { log(LOG_ERR, "srread64: write(): %s\n", neterror()); return -1 ; } return status ; } int srreadahd64(s, infop, fd) SOCKET s; int fd; struct rfiostat *infop ; { int status; /* Return code */ int rcode; /* To send back errno */ int how; /* lseek mode */ off64_t offset; /* lseek offset */ off64_t offsetout; /* lseek offset */ int size; /* Requested read size */ int first; /* First block sent */ char *p; /* Pointer to buffer */ int reqlen; /* residual request length */ char tmpbuf[21]; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif /* * Receiving request. */ log(LOG_DEBUG, "rreadahd64(%d, %d)\n",s, fd); p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p,size); unmarshall_LONG(p,how) ; /* * Receiving request: we have 8 bytes more to read */ p= rqstbuf + RQSTSIZE ; reqlen = HYPERSIZE; log(LOG_DEBUG, "rreadahd64(%d, %d): reading %d bytes\n", s, fd, reqlen) ; serrno = 0; if ((status = netread_timeout(s, p , reqlen, RFIO_CTRL_TIMEOUT)) != reqlen) { log(LOG_ERR, "rreadahd64: read(): %s\n", neterror()); return -1 ; } unmarshall_HYPER(p,offset) ; /* * lseek() if needed. */ if ( how != -1 ) { log(LOG_DEBUG,"rread64(%d,%d): lseek64(%d,%s,%d)\n", s, fd, fd, u64tostr(offset,tmpbuf,0), how) ; infop->seekop++; if ( (offsetout= lseek64(fd,offset,how)) == -1 ) { rcode= errno ; status= -1 ; p= iobuffer ; marshall_WORD(p,RQST_FIRSTREAD) ; marshall_LONG(p,status) ; marshall_LONG(p,rcode) ; serrno = 0; if ( netwrite_timeout(s,iobuffer,iobufsiz,RFIO_CTRL_TIMEOUT) != iobufsiz ) { log(LOG_ERR, "rreadahd64(): netwrite_timeout(): %s\n",neterror()); return -1 ; } return status ; } } /* * Allocating buffer if not large enough. */ log(LOG_DEBUG, "rreadahd64(%d, %d): checking buffer size %d\n", s, fd, size); if (iobufsiz < (size+WORDSIZE+3*LONGSIZE)) { int optval ; /* setsockopt opt value */ if (iobufsiz > 0) { log(LOG_DEBUG, "rreadahd64(): freeing %x\n",iobuffer); (void) free(iobuffer); } if ((iobuffer = malloc(size+WORDSIZE+3*LONGSIZE)) == NULL) { log(LOG_ERR, "rreadahd64: malloc(): %s\n", strerror(errno)) ; (void) close(s) ; return -1 ; } iobufsiz = size+WORDSIZE+3*LONGSIZE ; optval = (iobufsiz > 64 * 1024) ? iobufsiz : (64 * 1024); log(LOG_DEBUG, "rreadahd64(): allocated %d bytes at %x\n",iobufsiz,iobuffer); serrno = 0; if( setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char*)&optval, sizeof(optval)) == SOCKET_ERROR ) log(LOG_ERR, "rreadahd64(): setsockopt(SO_SNDBUF): %s\n", neterror()); else log(LOG_DEBUG, "rreadahd64(): setsockopt(SO_SNDBUF): %d\n",optval) ; } /* * Reading data and sending it. */ for(first= 1;;first= 0) { fd_set fds ; struct timeval timeout ; /* * Has a new request arrived ? */ FD_ZERO(&fds) ; FD_SET(s,&fds) ; timeout.tv_sec = 0 ; timeout.tv_usec= 0 ; serrno = 0; if( select(FD_SETSIZE, &fds, (fd_set*)0, (fd_set*)0, &timeout) == SOCKET_ERROR ) { log(LOG_ERR,"rreadahd64(): select(): %s\n", neterror()); return -1; } if ( FD_ISSET(s,&fds) ) { log(LOG_DEBUG,"rreadahd64(): returns because of new request\n") ; return 0 ; } /* * Reading disk ... */ p= iobuffer + WORDSIZE + 3*LONGSIZE ; status = read(fd,p,size); if (status < 0) { rcode= errno ; iobufsiz= WORDSIZE+3*LONGSIZE ; } else { rcode= 0 ; infop->rnbr+= status ; iobufsiz = status+WORDSIZE+3*LONGSIZE ; } log(LOG_DEBUG, "rreadahd64: status %d, rcode %d\n", status, rcode); /* * Sending data. */ p= iobuffer ; marshall_WORD(p,(first)?RQST_FIRSTREAD:RQST_READAHD64) ; marshall_LONG(p,status) ; marshall_LONG(p, rcode) ; marshall_LONG(p, status) ; serrno = 0; if ( netwrite_timeout(s, iobuffer, iobufsiz, RFIO_CTRL_TIMEOUT) != iobufsiz ) { log(LOG_ERR, "rreadahd64(): netwrite_timeout(): %s\n", neterror()); return -1 ; } /* * The end of file has been reached * or an error was encountered. */ if ( status != size ) { return 0 ; } } } int srfstat64(s, infop, fd) SOCKET s; int fd; struct rfiostat *infop; { int status; int rcode = 0; int msgsiz; int headlen = 3*LONGSIZE+WORDSIZE; char *p; struct stat64 statbuf; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif log(LOG_DEBUG, "rfstat64(%d, %d)\n", s, fd) ; infop->statop++; /* * Issuing the fstat() */ status= fstat64(fd, &statbuf) ; if ( status < 0) { rcode= errno ; log(LOG_ERR,"rfstat64(%d,%d): fstat64 gave rc %d, errno=%d\n", s, fd, status, errno); } else errno = 0; #if !defined(_WIN32) msgsiz= 5*WORDSIZE + 4*LONGSIZE + 3*HYPERSIZE ; #else msgsiz= 5*WORDSIZE + 3*LONGSIZE + 2*HYPERSIZE ; #endif p = rqstbuf; marshall_WORD(p, RQST_FSTAT64) ; marshall_LONG(p, status) ; marshall_LONG(p, rcode) ; marshall_LONG(p, msgsiz) ; marshall_WORD(p, statbuf.st_dev); marshall_HYPER(p, statbuf.st_ino); marshall_WORD(p, statbuf.st_mode); marshall_WORD(p, statbuf.st_nlink); marshall_WORD(p, statbuf.st_uid); marshall_WORD(p, statbuf.st_gid); marshall_HYPER(p, statbuf.st_size); marshall_LONG(p, statbuf.st_atime); marshall_LONG(p, statbuf.st_mtime); marshall_LONG(p, statbuf.st_ctime); #if !defined(_WIN32) marshall_LONG(p, statbuf.st_blksize); marshall_HYPER(p, statbuf.st_blocks); #endif log(LOG_DEBUG, "rfstat64(%d,%d): sending back %d bytes, status=%d\n", s, fd, msgsiz, status) ; serrno = 0; if (netwrite_timeout(s,rqstbuf,headlen+msgsiz,RFIO_CTRL_TIMEOUT) != (headlen+msgsiz) ) { log(LOG_ERR,"rfstat64(%d,%d): netwrite(): %s\n", s, fd, neterror()); return -1 ; } return 0 ; } int srlseek64(s, request, infop, fd) SOCKET s; int request; int fd; struct rfiostat *infop; { int status; int rcode; int rlen; off64_t offset; off64_t offsetout; int how; char *p; char tmpbuf[21]; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p= rqstbuf + 2*WORDSIZE ; unmarshall_HYPER(p,offset) ; unmarshall_LONG(p,how) ; log(LOG_DEBUG, "srlseek64(%d, %d): offset64 %s, how: %x\n", s, fd, u64tostr(offset,tmpbuf,0), how) ; offsetout = lseek64(fd, offset, how) ; if (offsetout == (off64_t)-1 ) status = -1; else status = 0; rcode= ( status < 0 ) ? errno : 0 ; log(LOG_DEBUG, "srlseek64: status %s, rcode %d\n", u64tostr(offsetout,tmpbuf,0), rcode) ; p= rqstbuf ; marshall_WORD(p,request) ; marshall_HYPER(p, offsetout) ; marshall_LONG(p,rcode) ; rlen = WORDSIZE+LONGSIZE+HYPERSIZE; serrno = 0; if (netwrite_timeout(s,rqstbuf,rlen,RFIO_CTRL_TIMEOUT) != rlen) { log(LOG_ERR, "srlseek64: netwrite(): %s\n", neterror()) ; return -1 ; } return status ; } int srpreseek64(s, infop, fd) SOCKET s; int fd; struct rfiostat *infop; { int status; /* Return code */ int size; /* Buffer size */ int nblock; /* Nb of blocks to read */ int first; /* First block sent */ char *p; /* Pointer to buffer */ int reqno; /* Request number */ struct iovec64 *v; /* List of requests */ char *trp = NULL; /* Temporary buffer */ #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p,size) ; unmarshall_LONG(p,nblock) ; log(LOG_DEBUG,"rpreseek64(%d, %d)\n",s,fd) ; /* * A temporary buffer may need to be created * to receive the request. */ if ( nblock*(HYPERSIZE+LONGSIZE) > BUFSIZ ) { if ( (trp= (char *) malloc(nblock*(HYPERSIZE+LONGSIZE))) == NULL ) { return -1 ; } } p= ( trp ) ? trp : rqstbuf ; /* * Receiving the request. */ log(LOG_DEBUG,"rpreseek64: reading %d bytes\n",nblock*(HYPERSIZE+LONGSIZE)) ; serrno = 0; if ( netread_timeout(s,p,nblock*(HYPERSIZE+LONGSIZE),RFIO_CTRL_TIMEOUT) != (nblock*(HYPERSIZE+LONGSIZE)) ) { log(LOG_ERR,"rpreseek64: netread(): %s\n", neterror()); if ( trp ) (void) free(trp) ; return -1 ; } /* * Allocating space for the list of requests. */ if ( (v= ( struct iovec64 *) malloc(nblock*sizeof(struct iovec64))) == NULL ) { log(LOG_ERR, "rpreseek64: malloc(): %s\n",strerror(errno)) ; if ( trp ) (void) free(trp) ; (void) close(s) ; return -1 ; } /* * Filling list request. */ for(reqno= 0;reqno 0) { log(LOG_DEBUG, "rpreseek64(): freeing %x\n",iobuffer); (void) free(iobuffer); } if ((iobuffer = malloc(size+WORDSIZE+3*LONGSIZE)) == NULL) { log(LOG_ERR, "rpreseek64: malloc(): %s\n", strerror(errno)) ; (void) close(s) ; return -1 ; } iobufsiz = size+WORDSIZE+3*LONGSIZE ; optval = (iobufsiz > 64 * 1024) ? iobufsiz : (64 * 1024); log(LOG_DEBUG, "rpreseek64(): allocated %d bytes at %x\n",iobufsiz,iobuffer) ; serrno = 0; if( setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char*)&optval, sizeof(optval)) == SOCKET_ERROR ) log(LOG_ERR, "rpreseek64(): setsockopt(SO_SNDBUF): %s\n", neterror()); else log(LOG_DEBUG, "rpreseek64(): setsockopt(SO_SNDBUF): %d\n",optval) ; } /* * Reading data and sending it. */ reqno= 0 ; for(first= 1;;first= 0) { struct timeval timeout ; fd_set fds ; int nbfree ; int nb ; off64_t offsetout ; /* * Has a new request arrived ? * The preseek is then interrupted. */ FD_ZERO(&fds) ; FD_SET(s,&fds) ; timeout.tv_sec = 0 ; timeout.tv_usec= 0 ; serrno = 0; if( select(FD_SETSIZE, &fds, (fd_set*)0, (fd_set*)0, &timeout) == SOCKET_ERROR ) { log(LOG_ERR,"rpreseek64(): select(): %s\n", neterror()); return -1; } if ( FD_ISSET(s,&fds) ) { log(LOG_DEBUG,"rpreseek64(): returns because of new request\n") ; return 0 ; } /* * Filling buffer. */ p= iobuffer + WORDSIZE + 3*LONGSIZE ; for(nb= 0, nbfree= size; HYPERSIZE+3*LONGSIZErnbr += status ; nbfree -= status ; p += status ; } } else { /* * The record is broken into two pieces. */ status= read(fd,p+HYPERSIZE+3*LONGSIZE,nbfree) ; marshall_HYPER(p,v[reqno].iov_base) ; marshall_LONG(p,nbfree) ; marshall_LONG(p,status) ; marshall_LONG(p,errno) ; if ( status != -1 ) { infop->rnbr += status ; nbfree -= status ; p += status ; v[reqno].iov_base += status ; v[reqno].iov_len -= status ; reqno -- ; } } } p= iobuffer ; if ( first ) { marshall_WORD(p,RQST_FIRSTSEEK) ; } else { marshall_WORD(p,(reqno == nblock) ? RQST_LASTSEEK:RQST_PRESEEK64) ; } marshall_LONG(p,nb) ; marshall_LONG(p,0) ; marshall_LONG(p,size) ; log(LOG_DEBUG,"rpreseek64(): sending %d bytes\n",iobufsiz) ; serrno = 0; if ( netwrite_timeout(s,iobuffer,iobufsiz,RFIO_CTRL_TIMEOUT) != iobufsiz ) { log(LOG_ERR, "rpreseek64(): netwrite_timeout(): %s\n", neterror()); return -1 ; } /* * All the data needed has been * sent over the network. */ if ( reqno == nblock ) return 0 ; } } /* Warning : the new sequential transfer mode cannot be used with several files open at a time (because of those global variables)*/ #if !defined(_WIN32) /* moved to global structure */ static int data_sock; /* Data socket */ static int ctrl_sock; /* the control socket */ static int first_write; static int first_read; static off64_t byte_read_from_network; static struct rfiostat myinfo; #endif /* WIN32 */ int sropen64_v3(s, rt, host) SOCKET s; int rt; /* Is it a remote site call ? */ char *host; /* Where the request comes from */ { char *auth_id; char *mech; int status; int rcode = 0; char *p; int len; int replen; int fd = -1; LONG flags, mode; int uid,gid; WORD mask, ftype, passwd, mapping; char account[MAXACCTSIZE]; /* account string */ char user[CA_MAXUSRNAMELEN+1]; /* User name */ char reqhost[MAXHOSTNAMELEN]; #if defined(_WIN32) SOCKET sock; #else int sock; /* Control socket */ int data_s; /* Data socket */ #endif #if defined(_AIX) socklen_t fromlen; #else int fromlen; #endif int port; struct sockaddr_storage from; extern int max_rcvbuf; extern int max_sndbuf; int optlen; /* Socket option length */ int yes; /* Socket option value */ int maxseg; /* Socket option segment*/ off64_t offsetout; /* Offset */ char tmpbuf[21]; #if defined(_WIN32) struct thData *td; #endif extern int bind_v3_data_port (char*, SOCKET); #if defined(_WIN32) td = (struct thData*)TlsGetValue(tls_i); #endif /* Initialization of global variables */ ctrl_sock = s; data_sock = -1; first_write = 1; first_read = 1; /* Init myinfo to zeros */ myinfo.readop = myinfo.writop = myinfo.flusop = myinfo.statop = myinfo.seekop = myinfo.presop = 0; myinfo.rnbr = myinfo.wnbr = (off64_t)0; /* Will remain at this value (indicates that the new sequential transfer mode has been used) */ myinfo.aheadop = 1; byte_read_from_network = (off64_t)0; p= rqstbuf + 2*WORDSIZE ; unmarshall_LONG(p, len) ; if ( (status = srchkreqsize(s,p,len)) == -1 ) { rcode = errno; } else { /* * Reading open request. */ log(LOG_DEBUG,"ropen64_v3(%d): reading %d bytes\n", s, len) ; serrno = 0; if ((status = netread_timeout(s,rqstbuf,len,RFIO_CTRL_TIMEOUT)) != len) { log(LOG_ERR,"ropen64_v3: read(): %s\n", neterror()); return -1 ; } p= rqstbuf ; status = 0; *account = *filename = *user = *reqhost = '\0'; unmarshall_WORD(p, uid); unmarshall_WORD(p, gid); unmarshall_WORD(p, mask); unmarshall_WORD(p, ftype); unmarshall_LONG(p, flags); unmarshall_LONG(p, mode); if (unmarshall_STRINGN(p, account, MAXACCTSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } if (unmarshall_STRINGN(p, filename, MAXFILENAMSIZE) == -1 ) { if (status == 0) { status = -1 ; rcode = SENAMETOOLONG; } } if (unmarshall_STRINGN(p, user, CA_MAXUSRNAMELEN+1) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } if (unmarshall_STRINGN(p, reqhost, MAXHOSTNAMELEN) == -1 ) { if (status == 0) { status = -1 ; rcode = E2BIG; } } unmarshall_LONG(p, passwd); unmarshall_WORD(p, mapping); get_client_actual_id(&uid, &gid, &mech, &auth_id, &rt, &mapping); log(LOG_DEBUG,"ropen64_v3: Opening file %s for remote user: %s\n", filename, user); if (rt) log(LOG_DEBUG,"ropen64_v3: Mapping : %s\n", mapping ? "yes" : "no"); if (rt && !mapping) { log(LOG_DEBUG,"ropen64_v3: user : %d, uid: %d, gid: %d\n", passwd, uid, gid); } /* * Someone in the site has tried to specify (uid,gid) directly ! */ if (!mapping && !rt) { log(LOG_INFO,"ropen64_v3: attempt to make non-mapped I/O and modify uid or gid !\n"); errno=EACCES ; rcode=errno ; status= -1 ; } if ( rt ) { openlog("rfio", LOG_PID, LOG_USER); syslog(LOG_ALERT, "rfio: connection %s mapping by %s(%d,%d) from %s\n", (mapping ? "with" : "without"), user, uid, gid, host) ; #if !defined(_WIN32) closelog(); #endif } /* * MAPPED mode: user will be mapped to user "to" */ if ( !status && rt && mapping ) { char to[100]; int rcd,to_uid,to_gid; log(LOG_DEBUG,"ropen64_v3: Mapping (%s, %d, %d) \n", user, uid, gid ); if ( (rcd = get_user(host,user,uid,gid,to,&to_uid,&to_gid)) == -ENOENT ) { log(LOG_ERR,"ropen64_v3: get_user() error opening mapping file\n") ; status = -1; errno = EINVAL; rcode = SEHOSTREFUSED ; } else if ( abs(rcd) == 1 ) { log(LOG_ERR,"ropen64_v3: No entry found in mapping file for (%s,%s,%d,%d)\n", host, user, uid, gid); status = -1; errno = EACCES; rcode = SEHOSTREFUSED; } else { log(LOG_DEBUG,"ropen64_v3: (%s,%s,%d,%d) mapped to %s(%d,%d)\n", host, user, uid, gid, to, to_uid, to_gid) ; uid = to_uid ; gid = to_gid ; if ( uid < 100 || gid < 100 ) { errno = EACCES; status = -1; rcode = SEHOSTREFUSED; } } } /* * DIRECT access: the user specifies uid & gid by himself */ if( !status && rt && !mapping ) { char *rtuser; if( (rtuser = getconfent("RTUSER","CHECK",0) ) == NULL || ! strcmp (rtuser,"YES") ) { /* Port is also passwd */ sock = connecttpread(reqhost, passwd); #if defined(_WIN32) if( (sock != INVALID_SOCKET) && !checkkey(sock, passwd) ) #else if( (sock >= 0) && !checkkey(sock, passwd) ) #endif { status= -1 ; errno = EACCES; rcode= errno ; log(LOG_ERR,"ropen64_v3: DIRECT mapping : permission denied\n"); } #if defined(_WIN32) if( sock == INVALID_SOCKET ) #else if (sock < 0) #endif { status= -1 ; log(LOG_ERR,"ropen64_v3: DIRECT mapping failed: Couldn't connect %s\n", reqhost); rcode = EACCES; } } else log(LOG_INFO ,"ropen64_v3: Any DIRECT rfio request from out of site is authorized\n"); } if ( !status ) { char *pfn = NULL; int need_user_check = 1; log(LOG_DEBUG, "ropen64_v3: uid %d gid %d mask %o ftype %d flags 0%o mode 0%o\n", uid, gid, mask, ftype, flags, mode); log(LOG_DEBUG, "ropen64_v3: account: %s\n", account); log(LOG_INFO, "ropen64_v3: (%s,0%o,0%o) for (%d,%d)\n", filename, flags, mode, uid, gid); status = rfio_handle_open(filename, ntohopnflg(flags), mode, mech, auth_id, uid, gid, &pfn, &handler_context, &need_user_check); if (status < 0) { char alarmbuf[1024]; rcode = serrno; sprintf(alarmbuf,"sropen(): %s",filename) ; log(LOG_DEBUG, "sropen: rfio_handler_open refused open: %s\n", sstrerror(serrno)) ; rfio_alrm(rcode,alarmbuf) ; } #if !defined(_WIN32) if (! status && need_user_check && ((status=chsuser(uid,gid,host,&rcode,((ntohopnflg(flags) & (O_WRONLY|O_RDWR)) != 0) ? "WTRUST" : "RTRUST")) < 0) && ((status=chsuser(uid,gid,host,&rcode,"OPENTRUST")) < 0) ) { if (status == -2) log(LOG_ERR,"ropen64_v3: uid %d not allowed to open()\n", uid); else log(LOG_ERR,"ropen64_v3: failed at chsuser(), rcode %d\n", rcode); status = -1 ; } #endif if (! status) { if (! need_user_check) { /* managed file */ mode = 0660; (void) umask(0) ; } else (void) umask(mask) ; fd = open64(filename, ntohopnflg(flags), mode); #if defined(_WIN32) _setmode( fd, _O_BINARY ); /* default is text mode */ #endif if (fd < 0) { status= -1 ; rcode= errno ; log(LOG_DEBUG,"ropen64_v3: open64(%s,0%o,0%o): %s\n", filename, ntohopnflg(flags), mode, strerror(errno)) ; } else { /* File is opened */ log(LOG_DEBUG,"ropen64_v3: open64(%s,0%o,0%o) returned %d \n", filename, ntohopnflg(flags), mode, fd) ; if (! need_user_check && (ntohopnflg(flags) & O_CREAT)) /* new managed file */ chown(filename, stagersuperuser.pw_uid, stagersuperuser.pw_gid); /* * Getting current offset */ offsetout = lseek64(fd, (off64_t)0, SEEK_CUR) ; if (offsetout == ((off64_t)-1) ) { log(LOG_ERR,"ropen64_v3: lseek64(%d,0,SEEK_CUR): %s\n", fd,strerror(errno)) ; status = -1; rcode = errno; } else { log(LOG_DEBUG,"ropen64_v3: lseek64(%d,0,SEEK_CUR) returned %s\n", fd, u64tostr(offsetout,tmpbuf,0)) ; status = 0; } } } if (pfn != NULL) free(pfn); } if (! status && fd >= 0) { fromlen = sizeof(from); serrno = 0; if (getsockname(ctrl_sock, (struct sockaddr *)&from, &fromlen)) { log(LOG_ERR, "ropen64_v3: getsockname(): %s\n", neterror()); #if defined(_WIN32) return(-1); #else exit(1); #endif } serrno = 0; data_s = socket(from.ss_family, SOCK_STREAM, 0); if( data_s == INVALID_SOCKET ) { log( LOG_ERR, "ropen64_v3: datasocket(): %s\n", neterror()); #if defined(_WIN32) return(-1); #else exit(1); #endif } log(LOG_DEBUG, "ropen64_v3: data socket created fd=%d\n", data_s); serrno = 0; if ((port = bind_v3_data_port ("ropen64_v3", data_s)) < 0) { #if defined(_WIN32) return(-1); #else exit(1); #endif } log(LOG_INFO, "ropen64_v3: assigning data port %d\n", port); serrno = 0; if( listen(data_s, 5) == INVALID_SOCKET ) { log(LOG_ERR, "ropen64_v3: listen(%d): %s\n", data_s, neterror()); #if defined(_WIN32) return(-1); #else exit(1); #endif } } } /* * Sending back status to the client */ p= rqstbuf ; marshall_WORD(p,RQST_OPEN64_V3) ; replen = RQSTSIZE+HYPERSIZE; marshall_LONG(p,status); marshall_LONG(p,rcode) ; marshall_LONG(p,port) ; marshall_HYPER(p, offsetout); log(LOG_DEBUG, "ropen64_v3: sending back status(%d) and errno(%d)\n", status, rcode); errno = ECONNRESET; serrno = 0; if (netwrite_timeout(s,rqstbuf,replen,RFIO_CTRL_TIMEOUT) != replen) { log(LOG_ERR,"ropen64_v3: write(): %s\n", neterror()); return -1 ; } if (! status && fd >= 0) { /* * The rcvbuf on the data socket must be set _before_ * the connection is accepted! Otherwise the receiver will * only offer the default window, which for large MTU devices * (such as HIPPI) is far too small and performance goes down * the drain. * * The sndbuf must be set on the socket returned by accept() * as it is not inherited (at least not on SGI). * 98/08/05 - Jes */ log(LOG_DEBUG, "ropen64_v3: doing setsockopt %d RCVBUF\n", data_s); serrno = 0; if( setsockopt(data_s, SOL_SOCKET, SO_RCVBUF, (char*)&max_rcvbuf, sizeof(max_rcvbuf)) == SOCKET_ERROR ) { log(LOG_ERR, "ropen64_v3: setsockopt %d rcvbuf(%d bytes): %s\n", data_s, max_rcvbuf, neterror()); } else log(LOG_DEBUG, "ropen64_v3: setsockopt rcvbuf on data socket %d (%d bytes)\n", data_s, max_rcvbuf); for (;;) { fromlen = sizeof(from); log(LOG_DEBUG, "ropen64_v3: wait for accept to complete\n"); serrno = 0; data_sock = accept(data_s, (struct sockaddr*)&from, &fromlen); if( data_sock == INVALID_SOCKET ) { log(LOG_ERR, "ropen64_v3: data accept(%d): %s\n", data_s, neterror()); #if defined(_WIN32) return(-1); #else exit(1); #endif } else break; } log(LOG_DEBUG, "ropen64_v3: data accept is ok, fildesc=%d\n", data_sock); /* * Set the send socket buffer on the data socket (see comment * above before accept()) */ log(LOG_DEBUG, "ropen64_v3: doing setsockopt %d SNDBUF\n", data_sock); serrno = 0; if( setsockopt(data_sock, SOL_SOCKET, SO_SNDBUF, (char*)&max_sndbuf, sizeof(max_sndbuf)) == SOCKET_ERROR) { log(LOG_ERR, "ropen64_v3: setsockopt %d SNDBUF(%d bytes): %s\n", data_sock, max_sndbuf, neterror()); } else log(LOG_DEBUG, "ropen64_v3: setsockopt SNDBUF on data socket %d(%d bytes)\n", data_sock, max_sndbuf); /* Set the keepalive option on both sockets */ yes = 1; serrno = 0; if( setsockopt(data_sock, SOL_SOCKET, SO_KEEPALIVE, (char*)&yes, sizeof(yes)) == SOCKET_ERROR) { log(LOG_ERR, "ropen64_v3: setsockopt keepalive on data socket%d: %s\n", data_sock, neterror()); } else log(LOG_DEBUG, "ropen64_v3: setsockopt keepalive on data socket %d done\n", data_sock); yes = 1; serrno = 0; if( setsockopt(ctrl_sock, SOL_SOCKET, SO_KEEPALIVE, (char*)&yes, sizeof(yes)) == SOCKET_ERROR ) { log(LOG_ERR, "ropen64_v3: setsockopt keepalive on ctrl socket %d: %s\n", ctrl_sock, neterror()); } else log(LOG_DEBUG, "ropen64_v3: setsockopt keepalive on ctrl socket %d done\n", ctrl_sock); #if (defined(__osf__) && defined(__alpha) && defined(DUXV4)) /* Set the keepalive interval to 20 mns instead of the default 2 hours */ yes = 20 * 60; if (setsockopt(data_sock, IPPROTO_TCP, TCP_KEEPIDLE,(char *)&yes, sizeof(yes)) < 0) { log(LOG_ERR, "ropen64_v3: setsockopt keepidle on data socket %d: %s\n", data_sock, strerror(errno)); } log(LOG_DEBUG, "ropen64_v3: setsockopt keepidle on data socket %d done (%d sec)\n", data_sock, yes); yes = 20 * 60; if (setsockopt(ctrl_sock, IPPROTO_TCP, TCP_KEEPIDLE, (char *)&yes, sizeof(yes)) < 0) { log(LOG_ERR, "ropen64_v3: setsockopt keepidle on ctrl socket %d: %s\n", ctrl_sock, strerror(errno)); } log(LOG_DEBUG, "ropen64_v3: setsockopt keepidle on ctrl socket %d done (%d sec)\n", ctrl_sock, yes); #endif #if !(defined(__osf__) && defined(__alpha) && defined(DUXV4)) /* * TCP_NODELAY seems to cause small Hippi packets on Digital UNIX 4.x */ yes = 1; serrno = 0; if( setsockopt(data_sock, IPPROTO_TCP, TCP_NODELAY, (char*)&yes, sizeof(yes)) == SOCKET_ERROR ) { log(LOG_ERR, "ropen64_v3: setsockopt nodelay on data socket %d: %s\n", data_sock, neterror()); } else log(LOG_DEBUG,"ropen64_v3: setsockopt nodelay option set on data socket %d\n", data_sock); #endif /* !(defined(__osf__) && defined(__alpha) && defined(DUXV4)) */ yes = 1; serrno = 0; if( setsockopt(ctrl_sock, IPPROTO_TCP, TCP_NODELAY, (char*)&yes, sizeof(yes)) == SOCKET_ERROR ) { log(LOG_ERR, "ropen64_v3: setsockopt nodelay on ctrl socket %d: %s\n", ctrl_sock, neterror()); } else log(LOG_DEBUG,"ropen64_v3: setsockopt nodelay option set on ctrl socket %d\n", ctrl_sock); } #if defined(SACCT) rfioacct(RQST_OPEN64_V3,uid,gid,s,(int)ntohopnflg(flags),(int)mode,status,rcode,NULL,filename,NULL); #endif /* SACCT */ return fd ; } int srclose64_v3(s, infop, fd) SOCKET s; int fd; struct rfiostat *infop; { int status; int rcode; char *p; char tmpbuf[21], tmpbuf2[21]; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif /* Issue statistics */ log(LOG_INFO,"rclose64_v3(%d, %d): %d read, %d readahead, %d write, %d flush, %d stat, %d lseek and %d lockf\n", s, fd, myinfo.readop, myinfo.aheadop, myinfo.writop, myinfo.flusop, myinfo.statop, myinfo.seekop, myinfo.lockop); log(LOG_INFO,"rclose64_v3(%d, %d): %s bytes read and %s bytes written\n", s, fd, u64tostr(myinfo.rnbr,tmpbuf,0), u64tostr(myinfo.wnbr,tmpbuf2,0)) ; /* Close the local file */ status = close(fd) ; rcode = ( status < 0 ) ? errno : 0 ; /* Close the data socket */ if (data_sock >= 0) { serrno = 0; if( netclose(data_sock) == SOCKET_ERROR ) log(LOG_DEBUG, "rclose64_v3: Error closing data socket fildesc=%d, error=%s\n", data_sock, neterror()); else log(LOG_DEBUG, "rclose64_v3 : closing data socket fildesc=%d\n", data_sock); data_sock = -1; } /* Issue accounting */ #if defined(SACCT) rfioacct(RQST_CLOSE64_V3,0,0,s,0,0,status,rcode,&myinfo,NULL,NULL); #endif /* SACCT */ /* Send the answer to the client via ctrl_sock */ p= rqstbuf; marshall_WORD(p, RQST_CLOSE64_V3); marshall_LONG(p, status); marshall_LONG(p, rcode); errno = ECONNRESET; serrno = 0; if (netwrite_timeout(s, rqstbuf, RQSTSIZE, RFIO_CTRL_TIMEOUT) != RQSTSIZE) { log(LOG_ERR, "rclose64_v3: netwrite(): %s\n", neterror()); return -1 ; } /* close the ctrl_sock */ serrno = 0; if( netclose(s) == SOCKET_ERROR ) log(LOG_DEBUG, "rclose64_v3: Error closing control socket fildesc=%d, error=%s\n", s, neterror()); else log(LOG_DEBUG, "rclose64_v3 : closing ctrl socket fildesc=%d\n", s); return status ; } static void *produce64_thread(int *ptr) { int fd = *ptr; int byte_read = -1; int error = 0; off64_t total_produced = 0; char tmpbuf[21]; while ((! error) && (byte_read != 0)) { if (stop_read) return (NULL); log(LOG_DEBUG, "produce64_thread: calling Csemaphore_down(&empty64)\n"); Csemaphore_down(&empty64); log(LOG_DEBUG, "produce64_thread: read() at %s:%d\n", __FILE__, __LINE__); byte_read = read(fd,array[produced64 % daemonv3_rdmt_nbuf].p,daemonv3_rdmt_bufsize); if (byte_read > 0) { total_produced += byte_read; /* printf("Has read in buf %d (len %d)\n",produced64 % daemonv3_rdmt_nbuf,byte_read); */ log(LOG_DEBUG, "Has read in buf %d (len %d)\n",produced64 % daemonv3_rdmt_nbuf,byte_read); array[produced64 % daemonv3_rdmt_nbuf].len = byte_read; } else { if (byte_read == 0) { log(LOG_DEBUG,"produce64_thread: End of reading : total produced = %s,buffers=%d\n", u64tostr(total_produced,tmpbuf,0),produced64); /* array[produced64 % daemonv3_rdmt_nbuf].p = NULL; */ array[produced64 % daemonv3_rdmt_nbuf].len = 0; } else { array[produced64 % daemonv3_rdmt_nbuf].len = -errno; error = -1; } } produced64++; log(LOG_DEBUG, "produce64_thread: calling Csemaphore_up(&full64)\n"); Csemaphore_up(&full64); } return(NULL); } static void *consume64_thread(int *ptr) { int fd = *ptr; int byte_written = -1; int error = 0, end = 0; off64_t total_consumed = 0; char *buffer_to_write; int len_to_write; int saved_errno; char tmpbuf[21]; while ((! error) && (! end)) { log(LOG_DEBUG, "consume64_thread: calling Csemaphore_down(&full64)\n"); Csemaphore_down(&full64); buffer_to_write = array[consumed64 % daemonv3_wrmt_nbuf].p; len_to_write = array[consumed64 % daemonv3_wrmt_nbuf].len; if (len_to_write > 0) { log(LOG_DEBUG,"consume64_thread: Trying to write %d bytes from %X\n", len_to_write, buffer_to_write); byte_written = write(fd, buffer_to_write, len_to_write); saved_errno = errno; log(LOG_DEBUG, "consume64_thread: succeeded to write %d bytes\n", byte_written); /* If the write is successfull but incomplete (fs is full) we report the ENOSPC error immediately in order to simplify the code */ if ((byte_written >= 0) && (byte_written != len_to_write)) { byte_written = -1; saved_errno = errno = ENOSPC; } /* Error reporting to global var */ if (byte_written == -1) { error = 1; if (Cthread_mutex_lock(&write_error)) { log(LOG_ERR,"consume64_thread: Cannot get mutex : serrno=%d\n", serrno); return(NULL); } write_error = saved_errno; if (Cthread_mutex_unlock(&write_error)) { log(LOG_ERR,"consume64_thread: Cannot release mutex : serrno=%d\n", serrno); return(NULL); } log(LOG_DEBUG,"consume64_thread: Error when writing : buffers=%d, error=%d\n", consumed64,saved_errno); } else { /* All bytes written to disks */ total_consumed += byte_written; log(LOG_DEBUG,"consume64_thread: Has written buf %d to disk (len %d)\n", consumed64 % daemonv3_wrmt_nbuf, byte_written); } } /* if (len_to_write > 0) */ else { if (len_to_write == 0) { log(LOG_DEBUG,"consume64_thread: End of writing : total consumed = %s, buffers=%d\n", u64tostr(total_consumed,tmpbuf,0), consumed64); end = 1; } else { /* Error indicated by the thread reading from network, this thread just terminates */ log(LOG_DEBUG,"consume64_thread: Error on reading : total consumed = %s, buffers=%d\n", u64tostr(total_consumed,tmpbuf,0), consumed64); error = 1; } } /* else (len_to_write > 0) */ consumed64++; log(LOG_DEBUG, "consume64_thread: calling Csemaphore_up(&empty64)\n"); Csemaphore_up(&empty64); } /* End of while */ return(NULL); } static void wait_consumer64_thread(int *cidp) { log(LOG_DEBUG,"wait_consumer64_thread: Entering wait_consumer64_thread\n"); if (*cidp<0) return; /* Indicate to the consumer thread that an error has occured */ /* The consumer thread will then terminate */ Csemaphore_down(&empty64); array[produced64 % daemonv3_wrmt_nbuf].len = -1; produced64++; Csemaphore_up(&full64); log(LOG_INFO, "wait_consumer64_thread: Joining thread\n"); if (Cthread_join(*cidp,NULL) < 0) { log(LOG_ERR,"wait_consumer64_thread: Error joining consumer thread, serrno=%d\n",serrno); return; } *cidp = -1; } static void wait_producer64_thread(int *cidp) { log(LOG_DEBUG,"wait_producer64_thread: Entering wait_producer64_thread\n"); if (*cidp<0) return; if (!stop_read) { stop_read = 1; Csemaphore_up(&empty64); } log(LOG_INFO, "wait_producer64_thread: Joining thread\n"); if (Cthread_join(*cidp,NULL) < 0) { log(LOG_ERR,"wait_producer64_thread: Error joining producer thread, serrno=%d\n",serrno); return; } *cidp = -1; } /* This function is used when finding an error condition on read64_v3 - Close the data stream - Trace statistics */ static int readerror64_v3(s, infop, cidp) SOCKET s; struct rfiostat* infop; int *cidp; { char tmpbuf[21], tmpbuf2[21]; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif /* We close the data socket */ if (data_sock >= 0) { serrno = 0; if( netclose(data_sock) == SOCKET_ERROR ) log(LOG_DEBUG, "readerror64_v3: Error closing data socket fildesc=%d, error=%s\n", data_sock, neterror()); else log(LOG_DEBUG, "readerror64_v3 : closing data socket fildesc=%d\n", data_sock); data_sock = -1; } /* Issue statistic messages - There is no accounting record generated */ log(LOG_INFO, "readerror64_v3(%d): %d read, %d readahead, %d write, %d flush, %d stat, %d lseek and %d lockf\n", s, infop->readop, infop->aheadop, infop->writop, infop->flusop, infop->statop, infop->seekop, infop->lockop); log(LOG_INFO,"readerror64_v3(%d): %s bytes read and %s bytes written\n", s, u64tostr(infop->rnbr,tmpbuf,0), u64tostr(infop->wnbr,tmpbuf2,0)) ; /* Free allocated memory */ if (!daemonv3_rdmt) { log(LOG_DEBUG,"readerror64_v3: freeing iobuffer at 0X%X\n", iobuffer); if (iobufsiz > 0) { free(iobuffer); iobuffer = NULL; iobufsiz = 0; } } else { wait_producer64_thread(cidp); if (array) { int el; for (el=0; el < daemonv3_rdmt_nbuf; el++) { log(LOG_DEBUG,"readerror64_v3: freeing array element %d at 0X%X\n", el,array[el].p); free(array[el].p); array[el].p = NULL; } log(LOG_DEBUG,"readerror64_v3: freeing array at 0X%X\n", array); free(array); array = NULL; } } return 0; } #if defined(_WIN32) int srread64_v3(s, infop, fd) SOCKET s; #else /* WIN32 */ int srread64_v3(ctrl_sock, infop, fd) int ctrl_sock; #endif /* else WIN32 */ int fd; struct rfiostat* infop; { int status; /* Return code */ int rcode; /* To send back errno */ int how; /* lseek mode */ off64_t offset; /* lseek offset */ off64_t offsetout; /* lseek offset */ int size; /* Requested write size */ char *p; /* Pointer to buffer */ #if !defined(_WIN32) char *iobuffer; #endif off64_t bytes2send; fd_set fdvar, fdvar2; extern int max_sndbuf; int optlen; struct stat64 st; char rfio_buf[BUFSIZ]; int eof_met; int DISKBUFSIZE_READ = (1 * 1024 * 1024); int n; int cid1 = -1; int el; char tmpbuf[21]; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); ctrl_sock = s; #endif /* WIN32 */ /* * Receiving request, */ log(LOG_DEBUG, "rread64_v3(%d,%d)\n",ctrl_sock, fd); if (first_read) { char *p; first_read = 0; eof_met = 0; if( (p = getconfent("RFIO", "DAEMONV3_RDSIZE", 0)) != NULL ) { if (atoi(p) > 0) DISKBUFSIZE_READ = atoi(p); } daemonv3_rdmt = DAEMONV3_RDMT; if( (p = getconfent("RFIO", "DAEMONV3_RDMT", 0)) != NULL ) if (*p == '0') daemonv3_rdmt = 0; else daemonv3_rdmt = 1; daemonv3_rdmt_nbuf = DAEMONV3_RDMT_NBUF; if( (p = getconfent("RFIO", "DAEMONV3_RDMT_NBUF", 0)) != NULL ) if (atoi(p) > 0) daemonv3_rdmt_nbuf = atoi(p); daemonv3_rdmt_bufsize = DAEMONV3_RDMT_BUFSIZE; if( (p = getconfent("RFIO", "DAEMONV3_RDMT_BUFSIZE", 0)) != NULL ) if (atoi(p) > 0) daemonv3_rdmt_bufsize = atoi(p); log(LOG_DEBUG, "rread64_v3(%d) : daemonv3_rdmt=%d,daemonv3_rdmt_nbuf=%d,daemonv3_rdmt_bufsize=%d\n", ctrl_sock, daemonv3_rdmt,daemonv3_rdmt_nbuf,daemonv3_rdmt_bufsize); if (daemonv3_rdmt) { /* Indicates we are using RFIO V3 and multithreadding while reading */ myinfo.aheadop = 3; /* Allocating circular buffer itself */ log(LOG_DEBUG, "rread64_v3: allocating circular buffer : %d bytes\n", sizeof(struct element) * daemonv3_rdmt_nbuf); array = (struct element *)malloc(sizeof(struct element) * daemonv3_rdmt_nbuf); if (array == NULL) { log(LOG_ERR, "rread64_v3: malloc array: ERROR occured (errno=%d)\n", errno); readerror64_v3(ctrl_sock, &myinfo, &cid1); return -1 ; } log(LOG_DEBUG, "rread64_v3: malloc array allocated : 0X%X\n", array); /* Allocating memory for each element of circular buffer */ for (el=0; el < daemonv3_rdmt_nbuf; el++) { log(LOG_DEBUG, "rread64_v3: allocating circular buffer element %d: %d bytes\n", el, daemonv3_rdmt_bufsize); if ((array[el].p = (char *)malloc(daemonv3_rdmt_bufsize)) == NULL) { log(LOG_ERR, "rread64_v3: malloc array element %d, size %d: ERROR %d occured\n", el, daemonv3_rdmt_bufsize, errno); readerror64_v3(ctrl_sock, &myinfo, &cid1); return -1 ; } log(LOG_DEBUG, "rread64_v3: malloc array element %d allocated : 0X%X\n", el, array[el].p); } } else { log(LOG_DEBUG, "rread64_v3: allocating malloc buffer : %d bytes\n", DISKBUFSIZE_READ); if ((iobuffer = (char *)malloc(DISKBUFSIZE_READ)) == NULL) { log(LOG_ERR, "rread64_v3: malloc: ERROR occured (errno=%d)\n", errno); readerror64_v3(ctrl_sock, &myinfo, &cid1); return -1 ; } log(LOG_DEBUG, "rread64_v3: malloc buffer allocated : 0X%X\n", iobuffer); iobufsiz = DISKBUFSIZE_READ; } if (fstat64(fd,&st) < 0) { log(LOG_ERR, "rread64_v3: fstat(): ERROR occured (errno=%d)\n", errno); readerror64_v3(ctrl_sock, &myinfo, &cid1); return -1 ; } log(LOG_DEBUG, "rread64_v3: filesize : %s bytes\n", u64tostr(st.st_size,tmpbuf,0)); offsetout = lseek64(fd,0L,SEEK_CUR); if (offsetout == (off64_t)-1) { log(LOG_ERR, "rread64_v3: lseek64(%d,0,SEEK_CUR): %s\n", fd, strerror(errno)) ; readerror64_v3(ctrl_sock, &myinfo, &cid1); return -1 ; } bytes2send = st.st_size - offsetout; if (bytes2send < 0) bytes2send = 0; log(LOG_DEBUG, "rread64_v3: %s bytes to send (offset taken into account)\n", u64tostr(bytes2send,tmpbuf,0)); p = rfio_buf; marshall_WORD(p,RQST_READ64_V3); marshall_HYPER(p,bytes2send); log(LOG_DEBUG, "rread64_v3: sending %d bytes\n", RQSTSIZE); errno = ECONNRESET; serrno = 0; n = netwrite_timeout(ctrl_sock, rfio_buf, RQSTSIZE, RFIO_CTRL_TIMEOUT); if (n != RQSTSIZE) { log(LOG_ERR, "rread64_v3: netwrite() ERROR: %s\n", neterror()); readerror64_v3(ctrl_sock, &myinfo, &cid1); return -1 ; } if (daemonv3_rdmt) { Csemaphore_init(&empty64,daemonv3_rdmt_nbuf); Csemaphore_init(&full64,0); stop_read = 0; if ((cid1 = Cthread_create((void *(*)(void *))produce64_thread,(void *)&fd)) < 0) { log(LOG_ERR,"rread64_v3: Cannot create producer thread : serrno=%d,errno=%d\n", serrno, errno); readerror64_v3(ctrl_sock, &myinfo, &cid1); return(-1); } } } /* end of if (first_read) */ /* * Reading data from the network. */ while (1) { struct timeval t; fd_set *write_fdset; FD_ZERO(&fdvar); FD_SET(ctrl_sock, &fdvar); FD_ZERO(&fdvar2); if (data_sock >= 0) FD_SET(data_sock, &fdvar2); t.tv_sec = 10; t.tv_usec = 0; if (eof_met) write_fdset = NULL; else write_fdset = &fdvar2; log(LOG_DEBUG,"srread64_v3: doing select\n") ; serrno = 0; if( select(FD_SETSIZE, &fdvar, write_fdset, NULL, &t) == SOCKET_ERROR ) { log(LOG_ERR, "srread64_v3: select failed: %s\n", neterror()); readerror64_v3(ctrl_sock, &myinfo, &cid1); return -1; } if( FD_ISSET(ctrl_sock, &fdvar) ) { int n, magic, code; /* Something received on the control socket */ log(LOG_DEBUG, "srread64_v3: ctrl socket: reading %d bytes\n", RQSTSIZE) ; errno = ECONNRESET; serrno = 0; n = netread_timeout(ctrl_sock,rqstbuf,RQSTSIZE,RFIO_CTRL_TIMEOUT); if (n != RQSTSIZE) { log(LOG_ERR, "srread64_v3: read ctrl socket %d: netread(): %s\n", ctrl_sock, neterror()); readerror64_v3(ctrl_sock, &myinfo, &cid1); return -1 ; } p = rqstbuf ; unmarshall_WORD(p,magic) ; unmarshall_WORD(p,code) ; /* what to do ? */ if (code == RQST_CLOSE64_V3) { log(LOG_DEBUG,"srread64_v3: close request: magic: %x code: %x\n", magic, code); if (!daemonv3_rdmt) { log(LOG_DEBUG,"srread64_v3: freeing iobuffer at 0X%X\n", iobuffer); if (iobufsiz > 0) { free(iobuffer); iobufsiz = 0; iobuffer = NULL; } } else { wait_producer64_thread(&cid1); if (cid1 >= 0) { log(LOG_ERR,"srread64_v3: Error joining producer, serrno=%d\n", serrno); readerror64_v3(ctrl_sock, &myinfo, &cid1); return(-1); } for (el=0; el < daemonv3_rdmt_nbuf; el++) { log(LOG_DEBUG,"srread64_v3: freeing array element %d at 0X%X\n", el,array[el].p); free(array[el].p); array[el].p = NULL; } log(LOG_DEBUG,"srread64_v3: freeing array at 0X%X\n", array); free(array); array = NULL; } srclose64_v3(ctrl_sock,&myinfo,fd); return 0; } else { log(LOG_ERR,"srread64_v3: unknown request: magic: %x code: %x\n", magic,code); readerror64_v3(ctrl_sock, &myinfo, &cid1); return(-1); } } /* if( FD_ISSET(ctrl_sock, &fdvar) ) */ /* * Reading data on disk. */ if( !eof_met && data_sock >= 0 && (FD_ISSET(data_sock, &fdvar2)) ) { if (daemonv3_rdmt) { Csemaphore_down(&full64); if (array[consumed64 % daemonv3_rdmt_nbuf].len > 0) { iobuffer = array[consumed64 % daemonv3_rdmt_nbuf].p; status = array[consumed64 % daemonv3_rdmt_nbuf].len; } else if (array[consumed64 % daemonv3_rdmt_nbuf].len == 0) { status = 0; iobuffer = NULL; log(LOG_DEBUG,"srread64_v3: Waiting for producer thread\n"); if (Cthread_join(cid1,NULL) < 0) { log(LOG_ERR,"srread64_v3: Error joining producer, serrno=%d\n", serrno); readerror64_v3(ctrl_sock, &myinfo, &cid1); return(-1); } cid1 = -1; } else if (array[consumed64 % daemonv3_rdmt_nbuf].len < 0) { status = -1; errno = -(array[consumed64 % daemonv3_rdmt_nbuf].len); } consumed64++; } else status = read(fd,iobuffer,DISKBUFSIZE_READ); rcode = (status < 0) ? errno:0; log(LOG_DEBUG, "srread64_v3: %d bytes have been read on disk\n", status) ; if (status == 0) { if (daemonv3_rdmt) { log(LOG_DEBUG, "srread64_v3: calling Csemaphore_up(&empty64)\n"); Csemaphore_up(&empty64); } eof_met = 1; p = rqstbuf; marshall_WORD(p,REP_EOF) ; log(LOG_DEBUG, "rread64_v3: eof\n") ; errno = ECONNRESET; serrno = 0; n = netwrite_timeout(ctrl_sock, rqstbuf, RQSTSIZE, RFIO_CTRL_TIMEOUT); if (n != RQSTSIZE) { log(LOG_ERR,"rread64_v3: netwrite(): %s\n", neterror()); readerror64_v3(ctrl_sock, &myinfo, &cid1); return -1 ; } } /* status == 0 */ else { if (status < 0) { if (daemonv3_rdmt) Csemaphore_up(&empty64); p = rqstbuf; marshall_WORD(p, REP_ERROR); marshall_LONG(p, status); marshall_LONG(p, rcode); log(LOG_DEBUG, "rread64_v3: status %d, rcode %d\n", status, rcode) ; errno = ECONNRESET; serrno = 0; n = netwrite_timeout(ctrl_sock, rqstbuf, RQSTSIZE, RFIO_CTRL_TIMEOUT); if (n != RQSTSIZE) { log(LOG_ERR, "rread64_v3: netwrite(): %s\n", neterror()); readerror64_v3(ctrl_sock, &myinfo, &cid1); return -1 ; } log(LOG_DEBUG, "read64_v3: waiting ack for error\n"); serrno = 0; n = netread_timeout(ctrl_sock,rqstbuf,RQSTSIZE,RFIO_CTRL_TIMEOUT); if (n != RQSTSIZE) { if (n == 0) #if defined(_WIN32) WSASetLastError(WSAECONNRESET); #else errno = ECONNRESET; #endif log(LOG_ERR, "read64_v3: read ctrl socket %d: read(): %s\n", ctrl_sock, neterror()); } /* n != RQSTSIZE */ readerror64_v3(ctrl_sock, &myinfo, &cid1); return(-1); } /* status < 0 */ else { /* status > 0, reading was succesfully */ log(LOG_DEBUG, "rread64_v3: writing %d bytes to data socket %d\n", status, data_sock) ; #if defined(_WIN32) WSASetLastError(WSAECONNRESET); if( (n = send(data_sock, iobuffer, status, 0)) != status ) { log(LOG_ERR, "rread64_v3: send() (to data sock): %s\n", geterr() ); readerror64_v3(ctrl_sock, &myinfo, &cid1); return -1; } #else /* WIN32 */ errno = ECONNRESET; if( (n = netwrite(data_sock, iobuffer, status)) != status ) { log(LOG_ERR, "rread64_v3: netwrite(): %s\n", strerror(errno)); readerror64_v3(ctrl_sock, &myinfo, &cid1); return -1 ; } #endif /* else WIN32 */ if (daemonv3_rdmt) Csemaphore_up(&empty64); myinfo.rnbr += status; myinfo.readop++; } /* else status < 0 */ } /* else status == 0 */ } /* if( !eof_met && (FD_ISSET(data_sock, &fdvar2)) ) */ } /* while (1) */ } /* This function is used when finding an error condition on write64_v3 - send a REP on the control stream - empty the DATA stream - wait for acknowledge on control stream */ static int writerror64_v3(s, rcode, infop, cidp) SOCKET s; int rcode; struct rfiostat *infop; int *cidp; { char *p; /* Pointer to buffer */ int status; int n; int el; fd_set fdvar2; struct timeval t; int sizeofdummy; char tmpbuf[21], tmpbuf2[21]; /* * Put dummy on heap to avoid large arrays in thread stack */ unsigned char *dummy = NULL; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif /* Send back error message */ status = -1; p = rqstbuf; marshall_WORD(p, REP_ERROR); marshall_LONG(p, status); marshall_LONG(p, rcode); log(LOG_ERR, "writerror64_v3: status %d, rcode %d (%s)\n", status, rcode, strerror(rcode)); errno = ECONNRESET; serrno = 0; n = netwrite_timeout(s, rqstbuf, RQSTSIZE, RFIO_CTRL_TIMEOUT); if (n != RQSTSIZE) { log(LOG_ERR, "writerror64_v3: write(): %s\n", neterror()); /* Consumer thread already exited after error */ } /* * To avoid overflowing the local thread stack we must * put dummy on heap */ sizeofdummy = 256 * 1024; dummy = (unsigned char *)malloc(sizeof(unsigned char) * sizeofdummy); if (dummy == NULL) log(LOG_ERR, "writerror64_v3: malloc(%d) for dummy: %s\n", sizeofdummy, strerror(errno)) ; /* There is a potential deadlock here since the client may be stuck in netwrite (cf rfio_write64_v3), trying to write data on the data socket while both socket buffers (client + server) are full. To avoid this problem, we empty the data socket while waiting for the ack to be received on the control socket */ while (dummy) { FD_ZERO(&fdvar2); FD_SET(s, &fdvar2); if (data_sock >= 0) FD_SET(data_sock, &fdvar2); t.tv_sec = 1; t.tv_usec = 0; log(LOG_DEBUG,"writerror64_v3: doing select after error writing on disk\n") ; #if defined(_WIN32) if( select(FD_SETSIZE, &fdvar2, NULL, NULL, &t) == SOCKET_ERROR ) #else if( select(FD_SETSIZE, &fdvar2, NULL, NULL, &t) < 0 ) #endif { #if defined(_WIN32) errno = WSAGetLastError(); #endif log(LOG_ERR, "writerror64_v3: select fdvar2 failed (errno=%d)\n", errno) ; /* Consumer thread already exited after error */ break ; } if ( FD_ISSET(s, &fdvar2) ) { /* The ack has been received on the control socket */ log(LOG_DEBUG, "writerror64_v3: waiting ack for error\n"); serrno = 0; n = netread_timeout(s, rqstbuf, RQSTSIZE, RFIO_CTRL_TIMEOUT); if (n != RQSTSIZE) { /* Connexion dropped (n==0) or some another error */ if (n == 0) #if defined(_WIN32) WSASetLastError(WSAECONNRESET); #else errno = ECONNRESET; #endif log(LOG_ERR, "writerror64_v3: read ctrl socket: read(): %s\n", neterror()); /* Consumer thread already exited after error */ break; } /* We have got the reply */ break; } /* if ( FD_ISSET(ctrl_sock, &fdvar2) ) */ if (data_sock >= 0 && FD_ISSET(data_sock, &fdvar2)) { /* Read as much data as possible from the data socket */ log(LOG_DEBUG, "writerror64_v3: emptying data socket (last disk write)\n"); serrno = 0; #if defined(_WIN32) n = recv(data_sock, dummy, sizeofdummy, 0); if( (n == 0) || (n == SOCKET_ERROR) ) #else n = read(data_sock, dummy, sizeofdummy); if( n <= 0 ) #endif { /* Connexion dropped (n==0) or some another error */ if (n == 0) #if defined(_WIN32) WSASetLastError(WSAECONNRESET); #else errno = ECONNRESET; #endif log(LOG_ERR, "writerror64_v3: read emptying data socket: recv(): %s\n", neterror()); /* Consumer thread already exited after error */ break; } log(LOG_DEBUG, "writerror64_v3: emptying data socket, %d bytes read\n", n); } /* if (FD_ISSET(data_sock,&fdvar2)) */ } /* End of while (1) : drop the data */ /* Close the data socket */ if (data_sock >= 0) { serrno = 0; if( netclose(data_sock) == SOCKET_ERROR ) log(LOG_DEBUG, "writerror64_v3: Error closing data socket fildesc=%d, error=%s\n", data_sock, neterror()); else log(LOG_DEBUG, "writerror64_v3 : closing data socket fildesc=%d\n", data_sock); data_sock = -1; } /* Issue statistic messages - There is no accounting record generated */ log(LOG_INFO, "writerror64_v3(%d): %d read, %d readahead, %d write, %d flush, %d stat, %d lseek and %d lockf\n", s, infop->readop, infop->aheadop, infop->writop, infop->flusop, infop->statop, infop->seekop, infop->lockop); log(LOG_INFO,"writerror64_v3(%d): %s bytes read and %s bytes written\n", s, u64tostr(infop->rnbr,tmpbuf,0), u64tostr(infop->wnbr,tmpbuf2,0)) ; /* free the allocated ressources */ free(dummy); dummy = NULL; if (!daemonv3_wrmt) { log(LOG_DEBUG,"writerror64_v3: freeing iobuffer at 0X%X\n", iobuffer); free(iobuffer); iobuffer = NULL; iobufsiz = 0; } else { wait_consumer64_thread(cidp); if (array) { for (el=0; el < daemonv3_wrmt_nbuf; el++) { log(LOG_DEBUG,"writerror64_v3: freeing array element %d at 0X%X\n", el,array[el].p); free(array[el].p); array[el].p = NULL; } log(LOG_DEBUG,"writerror64_v3: freeing array at 0X%X\n", array); free(array); array = NULL; } } return 0; } int srwrite64_v3(s, infop, fd) SOCKET s; int fd; struct rfiostat *infop; { int status; /* Return code */ int rcode; /* To send back errno */ int how; /* lseek mode */ int offset; /* lseek offset */ int size; /* Requested write size */ char *p; /* Pointer to buffer */ #if !defined(_WIN32) char *iobuffer; #endif fd_set fdvar; off64_t byte_written_by_client = 0; int eof_received = 0; int invalid_received = 0; extern int max_rcvbuf; int maxseg; #if defined(_AIX) socklen_t optlen; #else int optlen; #endif int byte_in_diskbuffer = 0; char *iobuffer_p; int max_rcv_wat; struct timeval t; int DISKBUFSIZE_WRITE = (1*1024*1024); int el; int cid2 = -1; int saved_errno; char tmpbuf[21], tmpbuf2[21]; #if defined(_WIN32) struct thData *td; td = (struct thData*)TlsGetValue(tls_i); #endif /* * Receiving request, */ log(LOG_DEBUG, "rwrite64_v3(%d, %d)\n",s, fd); if( first_write ) { char *p; first_write = 0; if ((p = getconfent("RFIO","DAEMONV3_WRSIZE",0)) != NULL) { if (atoi(p) > 0) DISKBUFSIZE_WRITE = atoi(p); } daemonv3_wrmt = DAEMONV3_WRMT; if( (p = getconfent("RFIO", "DAEMONV3_WRMT", 0)) != NULL ) if (*p == '0') daemonv3_wrmt = 0; else daemonv3_wrmt = 1; daemonv3_wrmt_nbuf = DAEMONV3_WRMT_NBUF; if( (p = getconfent("RFIO", "DAEMONV3_WRMT_NBUF", 0)) != NULL ) if (atoi(p) > 0) daemonv3_wrmt_nbuf = atoi(p); daemonv3_wrmt_bufsize = DAEMONV3_WRMT_BUFSIZE; DISKBUFSIZE_WRITE = DAEMONV3_WRMT_BUFSIZE; if( (p = getconfent("RFIO", "DAEMONV3_WRMT_BUFSIZE", 0)) != NULL ) if (atoi(p) > 0) { daemonv3_wrmt_bufsize = atoi(p); DISKBUFSIZE_WRITE = atoi(p); } log(LOG_DEBUG, "rwrite64_v3: daemonv3_wrmt=%d,daemonv3_wrmt_nbuf=%d,daemonv3_wrmt_bufsize=%d\n", daemonv3_wrmt,daemonv3_wrmt_nbuf,daemonv3_wrmt_bufsize); if (daemonv3_wrmt) { /* Indicates we are using RFIO V3 and multithreading while writing */ myinfo.aheadop = 3; /* Allocating circular buffer itself */ log(LOG_DEBUG, "rwrite64_v3: allocating circular buffer: %d bytes\n", sizeof(struct element) * daemonv3_wrmt_nbuf); array = (struct element *)malloc(sizeof(struct element) * daemonv3_wrmt_nbuf); if (array == NULL) { log(LOG_ERR, "rwrite64_v3: malloc array: ERROR occured (errno=%d)\n", errno); return -1 ; } log(LOG_DEBUG, "rwrite64_v3: malloc array allocated at 0X%X\n", array); /* Allocating memory for each element of circular buffer */ for (el=0; el < daemonv3_wrmt_nbuf; el++) { log(LOG_DEBUG, "rwrite64_v3: allocating circular buffer element %d: %d bytes\n", el,daemonv3_wrmt_bufsize); if ((array[el].p = (char *)malloc(daemonv3_wrmt_bufsize)) == NULL) { log(LOG_ERR, "rwrite64_v3: malloc array element %d: ERROR occured (errno=%d)\n", el, errno); return -1 ; } log(LOG_DEBUG, "rwrite64_v3: malloc array element %d allocated at 0X%X\n", el, array[el].p); } } /* Don't allocate this buffer if we are multithreaded */ if (!daemonv3_wrmt) { log(LOG_DEBUG, "rwrite64_v3: allocating malloc buffer: %d bytes\n", DISKBUFSIZE_WRITE); if ((iobuffer = (char *)malloc(DISKBUFSIZE_WRITE)) == NULL) { log(LOG_ERR, "rwrite64_v3: malloc: ERROR occured (errno=%d)\n", errno); return -1 ; } log(LOG_DEBUG, "rwrite64_v3: malloc buffer allocated at 0X%X\n", iobuffer); iobufsiz = DISKBUFSIZE_WRITE; } byte_in_diskbuffer = 0; if (daemonv3_wrmt) iobuffer_p = NULL; /* For safety */ else iobuffer_p = iobuffer; #if !defined(_WIN32) optlen = sizeof(maxseg); if (getsockopt(data_sock,IPPROTO_TCP,TCP_MAXSEG,(char *)&maxseg,&optlen) < 0) { log(LOG_ERR, "rwrite64_v3: getsockopt: ERROR occured (errno=%d)\n", errno) ; return -1 ; } log(LOG_DEBUG,"rwrite64_v3: max TCP segment: %d\n", maxseg); #endif /* WIN32 */ if (daemonv3_wrmt) { Csemaphore_init(&empty64,daemonv3_wrmt_nbuf); Csemaphore_init(&full64,0); if ((cid2 = Cthread_create((void *(*)(void *))consume64_thread,(void *)&fd)) < 0) { log(LOG_ERR,"rwrite64_v3: Cannot create consumer thread : serrno=%d, errno=%d\n", serrno, errno); return(-1); } } } /* if (firstwrite) */ /* * Reading data from the network. */ while (1) { FD_ZERO(&fdvar); FD_SET(ctrl_sock, &fdvar); if (data_sock >= 0) FD_SET(data_sock, &fdvar); t.tv_sec = 10; t.tv_usec = 0; log(LOG_DEBUG,"rwrite64_v3: doing select\n") ; serrno = 0; if( select(FD_SETSIZE, &fdvar, NULL, NULL, &t) == SOCKET_ERROR ) { log(LOG_ERR, "rwrite64_v3: select: %s\n", neterror()); if (daemonv3_wrmt) wait_consumer64_thread(&cid2); return -1; } /* Anything received on control socket ? */ if( FD_ISSET(ctrl_sock, &fdvar) ) { int n, magic, code; /* Something received on the control socket */ log(LOG_DEBUG, "rwrite64_v3: ctrl socket: reading %d bytes\n", RQSTSIZE) ; serrno = 0; n = netread_timeout(ctrl_sock, rqstbuf, RQSTSIZE, RFIO_CTRL_TIMEOUT); if ( n != RQSTSIZE ) { if (n == 0) #if defined(_WIN32) WSASetLastError(WSAECONNRESET); #else errno = ECONNRESET; #endif log(LOG_ERR, "rwrite64_v3: read ctrl socket: netread(): %s\n", neterror()); if (daemonv3_wrmt) wait_consumer64_thread(&cid2); return -1; } p = rqstbuf ; unmarshall_WORD(p, magic) ; unmarshall_WORD(p, code) ; unmarshall_HYPER(p, byte_written_by_client); if (code == RQST_CLOSE64_V3) { log(LOG_DEBUG,"rwrite64_v3: close request: magic: %x code: %x\n", magic, code) ; eof_received = 1; } else { log(LOG_ERR,"rwrite64_v3: unknown request: magic: %x code: %x\n", magic, code) ; writerror64_v3(ctrl_sock, EINVAL, &myinfo, &cid2); return -1; } log(LOG_DEBUG, "rwrite64_v3: data socket: read_from_net=%s, written_by_client=%s\n", u64tostr(byte_read_from_network,tmpbuf,0), u64tostr(byte_written_by_client,tmpbuf2,0)); } /* if (FD_ISSET(ctrl_sock, &fdvar)) */ /* Anything received on data socket ? */ if (data_sock >= 0 && FD_ISSET(data_sock, &fdvar)) { int n,can_be_read; if ((daemonv3_wrmt) && (byte_in_diskbuffer == 0)) { log(LOG_DEBUG, "rwrite64_v3: Data received on data socket, new buffer %d requested\n", produced64 % daemonv3_wrmt_nbuf); Csemaphore_down(&empty64); iobuffer = iobuffer_p = array[produced64 % daemonv3_wrmt_nbuf].p; } log(LOG_DEBUG,"rwrite64_v3: iobuffer_p = %X,DISKBUFSIZE_WRITE = %d, data socket = %d\n", iobuffer_p, DISKBUFSIZE_WRITE, data_sock); serrno = 0; #if defined(_WIN32) n = recv(data_sock, iobuffer_p, DISKBUFSIZE_WRITE-byte_in_diskbuffer, 0); if( (n == 0) || n == SOCKET_ERROR ) #else n = read(data_sock, iobuffer_p, DISKBUFSIZE_WRITE-byte_in_diskbuffer); if( n <= 0 ) #endif { if (n == 0) #if defined(_WIN32) WSASetLastError(WSAECONNRESET); #else errno = ECONNRESET; #endif log(LOG_ERR, "rwrite64_v3: read data socket: recv(): %s\n", neterror()); if (daemonv3_wrmt) wait_consumer64_thread(&cid2); return -1; } log(LOG_DEBUG, "rwrite64_v3: read data socket %d: %d bytes\n", data_sock, n); byte_read_from_network += n; byte_in_diskbuffer += n; iobuffer_p += n; } /* if (FD_ISSET(data_sock,&fdvar)) */ /* * Writing data on disk. */ if (byte_in_diskbuffer && (byte_in_diskbuffer == DISKBUFSIZE_WRITE || (eof_received && byte_written_by_client == byte_read_from_network)) ) { log(LOG_DEBUG, "rwrite64_v3: writing %d bytes on disk\n", byte_in_diskbuffer); if (daemonv3_wrmt) { array[produced64 % daemonv3_wrmt_nbuf].len = byte_in_diskbuffer; produced64++; Csemaphore_up(&full64); } /* if (daemonv3_wrmt) */ else { status = write(fd, iobuffer, byte_in_diskbuffer); /* If the write is successfull but incomplete (fs is full) we report the ENOSPC error immediately in order to simplify the code */ if ((status > 0) && (status != byte_in_diskbuffer)) { status = -1; errno = ENOSPC; } } /* Get the status value */ if (daemonv3_wrmt) { /* Caution: the write is done asynchroneously */ /* So the status is not related to the above write! */ /* Get the last write status within a mutex transaction */ if (Cthread_mutex_lock(&write_error)) { log(LOG_ERR,"rwrite64_v3: Cannot get mutex : serrno=%d\n", serrno); return(-1); } if (write_error) { status = -1; saved_errno = write_error; } else status = byte_in_diskbuffer; if (Cthread_mutex_unlock(&write_error)) { log(LOG_ERR,"rwrite64_v3: Cannot release mutex : serrno=%d\n", serrno); return(-1); } /* End of mutex transaction */ } if ((daemonv3_wrmt) && (status == -1)) errno = saved_errno; rcode = (status < 0) ? errno:0; if (status < 0) { /* Error in writting buffer */ writerror64_v3(ctrl_sock, rcode, &myinfo, &cid2); return -1; } /* if (status < 0) */ /* The data has be written on disk */ myinfo.wnbr += byte_in_diskbuffer; myinfo.writop++; byte_in_diskbuffer = 0; iobuffer_p = iobuffer; } /* if (byte_in_diskbuffer == DISKBUFSIZE_WRITE || eof_received || ...) */ /* Have we finished ? */ if ( eof_received && byte_written_by_client == myinfo.wnbr ) { if (!daemonv3_wrmt) { log(LOG_DEBUG,"rwrite64_v3: freeing iobuffer at 0X%X\n", iobuffer); free(iobuffer); iobuffer = NULL; iobufsiz = 0; } else { /* Indicate to the consumer thread that writing is finished */ /* if the actual buffer wasn't empty */ log(LOG_DEBUG, "rwrite64_v3: Terminates thread by null buffer %d requested\n", produced64 % daemonv3_wrmt_nbuf); Csemaphore_down(&empty64); array[produced64 % daemonv3_wrmt_nbuf].len = 0; produced64++; Csemaphore_up(&full64); /* Wait for consumer thread */ /* We can then safely catch deferred disk write errors */ log(LOG_INFO,"Joining thread\n"); if (Cthread_join(cid2,NULL) < 0) { log(LOG_ERR,"Error joining consumer, serrno=%d\n", serrno); return(-1); } cid2 = -1; /* Get the last write status within a mutex transaction */ if (Cthread_mutex_lock(&write_error)) { log(LOG_ERR,"rwrite64_v3: Cannot get mutex : serrno=%d\n", serrno); return(-1); } if (write_error) { status = -1; rcode = write_error; } else status = 0; if (Cthread_mutex_unlock(&write_error)) { log(LOG_ERR,"rwrite64_v3: Cannot release mutex : serrno=%d\n", serrno); return(-1); } /* End of mutex transaction */ /* If status is bad, bad news.... */ if (status < 0) { writerror64_v3(ctrl_sock, rcode, &myinfo, &cid2); return -1; } /* if (status < 0) */ /* Free the buffers */ for (el=0; el < daemonv3_wrmt_nbuf; el++) { log(LOG_DEBUG,"rwrite64_v3: freeing array element %d at 0X%X\n", el, array[el].p); free(array[el].p); array[el].p = NULL; } log(LOG_DEBUG,"rwrite64_v3: freeing array at 0X%X\n", array); free(array); array = NULL; } /* Send back final status and close sockets... and return */ srclose64_v3(ctrl_sock, &myinfo, fd); return 0; } /* if ( eof_received && byte_written_by_client == myinfo.wnbr ) */ } /* while (1) */ } lcgdm-1.10.0/rfio/rfio_mstat.man0000644000175000017500000000021110222773541016017 0ustar ellertellert.so ./rfio_stat.man .\" @(#)$RCSfile: rfio_mstat.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud lcgdm-1.10.0/rfio/stream64.c0000644000175000017500000011632311336205452014776 0ustar ellertellert/* * $Id: stream64.c 3172 2010-02-15 08:51:54Z baud $ */ /* * Copyright (C) 1990-2010 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: stream64.c,v $ $Revision: 3172 $ $Date: 2010-02-15 09:51:54 +0100 (Mon, 15 Feb 2010) $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy, F. Hassine, P. Gaillardon"; #endif /* not lint */ /* stream64.c Remote File I/O - Version 3 streaming routines */ #define RFIO_KERNEL 1 /* system part of Remote File I/O */ #include #include #include /* system logger */ #include #include #include #include "rfio.h" /* remote file I/O definitions */ #include "rfio_rfilefdt.h" #include "rfcntl.h" /* remote file control mapping macros */ #include "u64subr.h" #include #include #include "Castor_limits.h" #include #include #if !defined(_WIN32) #include #endif #if defined(_AIX) #include #endif #include #if defined(_WIN32) #include #else #include #include /* for inet_ntoa() */ #if ((defined(IRIX5) || defined(IRIX6)) && ! (defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN) && defined(PDP_ENDIAN))) #ifdef LITTLE_ENDIAN #undef LITTLE_ENDIAN #endif #define LITTLE_ENDIAN 1234 #ifdef BIG_ENDIAN #undef BIG_ENDIAN #endif #define BIG_ENDIAN 4321 #ifdef PDP_ENDIAN #undef PDP_ENDIAN #endif #define PDP_ENDIAN 3412 #endif #include #endif static int na_key = -1; EXTERN_C int DLL_DECL data_rfio_connect _PROTO((struct sockaddr *, int, char *, int *, int)); static void rfio_setup64_ext_v3(iop,uid,gid,passwd) RFILE *iop; int uid; int gid; int passwd; { extern char * getenv() ; /* External declaration */ char * cp ; /* Character pointer */ int v ; if ( cp= getenv("RFIO_READOPT") ) { v = atoi(cp) ; rfiosetopt(RFIO_READOPT, &v , 4) ; } iop->magic = RFIO_MAGIC; iop->mode64 = 1; iop->s = -1; if (uid || gid) iop->mapping=0; else iop->mapping=1; iop->passwd=passwd; /* used only if mapping == 0 */ iop->uid = (uid==0 ? geteuid(): uid); iop->gid = (gid==0 ? getegid(): gid); INIT_TRACE("RFIO_TRACE"); TRACE ( 1,"rfio","rfio_setup64_ext(%d,%d,%d)",iop,uid,gid); TRACE ( 2,"rfio","rfio_setup64_ext: owner s uid is %d",iop->uid); TRACE ( 2,"rfio","rfio_setup64_ext: owner s gid is %d",iop->gid); END_TRACE(); (void) umask(iop->umask=umask(0)); iop->ftype = FFTYPE_C; iop->binary = 0; /* no translation needed */ iop->eof = 0; iop->unit = 0; iop->access = 0; iop->format = 0; iop->recl = 0; iop->blank = 0; iop->opnopt = 0; iop->offset= 0 ; iop->_iobuf.base = NULL; iop->_iobuf.ptr = NULL; iop->_iobuf.count = 0; iop->_iobuf.hsize = 0; iop->_iobuf.dsize = 0; iop->lseekhow= -1 ; iop->ahead= rfioreadopt(RFIO_READOPT) & RFIO_READAHEAD ; iop->eof= 0 ; iop->readissued= 0 ; iop->preseek = 0 ; iop->nbrecord= 0 ; iop->version3 = 1; iop->offset64 = 0; iop->lseekoff64 = 0; strcpy(iop->host,"????????"); } int DLL_DECL rfio_open64_v3(filepath, flags, mode) char * filepath ; int flags,mode ; { char rh[1] ; rh[0]='\0' ; return(rfio_open64_ext_v3(filepath, flags, mode,(uid_t)0,(gid_t)0,0,rh)); } /* * Remote file open. */ int rfio_open64_ext_v3(filepath, flags, mode,uid,gid,passwd,reqhost) char * filepath ; int flags,mode ; uid_t uid; gid_t gid; int passwd ; char * reqhost; /* In case of a Non-mapped I/O with uid & gid sepcified, which host will be contacted for key check ? */ { int status ; /* Return code */ int rcode ; /* Remote errno */ int len ; /* Request length */ int rlen ; /* Reply length */ int save_errno, save_serrno; char * host ; /* Host name */ char * filename; /* File name */ char * account; /* VM vestiges ? */ char * p ; /* Pointer to rfio buffer */ RFILE * rfp ; /* Remote file pointer */ WORD req ; /* Request code */ struct passwd *pw; /* User identification */ int rt ; /* daemon in site(0) or not (1) */ int bufsize ; /* socket buffer size */ struct sockaddr_storage to; int tolen; extern void rfio_setup64_ext_v3(); extern char * getacct() ; extern char * getifnam() ; int data_port; int rem; int rb; int yes; /* Int for socket option */ off64_t offset ; /* Offset at open */ char rfio_buf[BUFSIZ]; int rfp_index, parserc; char tmpbuf[21]; const char *tname, *tip; /* Avoiding Valgrind error messages about uninitialized data */ memset(rfio_buf, 0, BUFSIZ); INIT_TRACE("RFIO_TRACE"); TRACE(1,"rfio","rfio_open64_ext(%s, 0%o, 0%o, %d, %d, %d, %s)", filepath,flags,mode,uid,gid,passwd,reqhost) ; #if defined (CLIENTLOG) /* Client logging */ rfio_logst(); #endif /* CLIENTLOG */ /* * The file is local. */ if ( ! (parserc = rfio_parse(filepath,&host,&filename)) ) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file */ TRACE(1,"rfio","rfio_open64_ext: %s is an HSM path", filename); END_TRACE(); rfio_errno = 0; return(rfio_HsmIf_open(filename,flags,mode,1)); } status= open64(filename, flags, mode) ; END_TRACE() ; rfio_errno = 0; #if defined (CLIENTLOG) /* Client logging */ rfio_logop(status,filename,host,flags); #endif /* CLIENTLOG */ return status ; } if (parserc < 0) { END_TRACE(); return(-1); } /* * Allocate and initialize a remote file descriptor. */ if ((rfp = (RFILE *)malloc(sizeof(RFILE))) == NULL) { save_errno = errno; TRACE(2, "rfio", "rfio_open64: malloc(): ERROR occured (errno=%d)", errno); END_TRACE(); errno = save_errno; return(-1); } rfio_setup64_ext_v3(rfp,(int)uid,(int)gid,passwd) ; TRACE(2, "rfio", "rfio_open64_ext_v3: RFIO descriptor allocated at 0x%X", rfp); /* * Connecting server. */ rfp->s = rfio_connect(host,&rt); if (rfp->s < 0) { save_errno = errno; TRACE(2, "rfio", "rfio_open64_ext_v3: Failing Doing first connect"); TRACE(2, "rfio", "rfio_open64_ext_v3: freeing RFIO descriptor at 0X%X", rfp); (void) free(rfp); END_TRACE(); errno = save_errno; return(-1); } tolen=sizeof(to); if (getpeername(rfp->s,(struct sockaddr *)&to, &tolen)<0) { save_errno = errno; syslog(LOG_ALERT, "rfio: rfio_open64_ext_v3: getpeername: %s\n",strerror(errno)); TRACE(2, "rfio", "rfio_open64_ext_v3: getpeername: %s\n",strerror(errno)); close(rfp->s); (void) free(rfp); END_TRACE(); errno = save_errno; return(-1); } tname = Cgetnetaddress(-1, &to, tolen, &na_key, &tip, NULL, 0, 0); if (tname == NULL || strlen(tip)>=RESHOSTNAMELEN) { TRACE(2, "rfio", "rfio_open64_ext_v3: Cgetnetaddress: %s\n",(tname == NULL) ? sstrerror(serrno) : "Names too long"); close(rfp->s); (void) free(rfp); END_TRACE(); return(-1); } if (strlen(tname)host, tname); else strcpy(rfp->host, tip); if ( !rt && !rfp->mapping ) { rfp->uid=geteuid() ; rfp->gid=getegid() ; TRACE(3,"rfio", "rfio_open64_ext_v3: re-setting (uid,gid) to %d,%d",rfp->uid,rfp->gid) ; rfp->mapping = 1 ; } /* * Remote file table is not large enough. */ if ((rfp_index = rfio_rfilefdt_allocentry(rfp->s)) == -1) { TRACE(2, "rfio", "rfio_open64_ext_v3: freeing RFIO descriptor at 0X%X", rfp); (void) close(rfp->s); (void) free(rfp); END_TRACE(); errno= EMFILE ; return -1 ; } rfilefdt[rfp_index]=rfp; bufsize= DEFIOBUFSIZE ; /* reset error code */ serrno=0; /* Initialization needed for RFIO version 3 write and read requests */ rfp->first_write = 1; rfp->wrbyte_net64 = 0; rfp->first_read = 1; rfp->rdbyte_net64 = 0; /* Set the keepalive option on socket */ yes = 1; if (setsockopt(rfp->s,SOL_SOCKET,SO_KEEPALIVE,(char *)&yes, sizeof(yes)) < 0) { TRACE(2,"rfio","rfio_open64_ext_v3: setsockopt keepalive on ctrl: %s",strerror(errno)); } TRACE(2,"rfio","rfio_open64_ext_v3: setsockopt keepalive on ctrl done"); #if (defined(__osf__) && defined(__alpha) && defined(DUXV4)) /* Set the keepalive interval to 20 mns instead of the default 2 hours */ yes = 20 * 60; if (setsockopt(rfp->s,IPPROTO_TCP,TCP_KEEPIDLE,(char *)&yes,sizeof(yes)) < 0) { TRACE(2,"rfio","rfio_open64_ext_v3: setsockopt keepidle on ctrl: %s",strerror(errno)); } TRACE(2,"rfio","rfio_open64_ext_v3: setsockopt keepidle on ctrl done (%d s)",yes); #endif #if !(defined(__osf__) && defined(__alpha) && defined(DUXV4)) yes = 1; if (setsockopt(rfp->s,IPPROTO_TCP,TCP_NODELAY,(char *)&yes,sizeof(yes)) < 0) { TRACE(2,"rfio","rfio_open64_ext_v3: setsockopt nodelay on ctrl: %s",strerror(errno)); } TRACE(2,"rfio","rfio_open64_ext_v3: setsockopt nodelay option set on ctrl socket"); #endif /* !(defined(__osf__) && defined(__alpha) && defined(DUXV4)) */ /* * Allocate, if necessary, an I/O buffer. */ rfp->_iobuf.hsize= 3*LONGSIZE + WORDSIZE ; if ( rfioreadopt(RFIO_READOPT) & RFIO_READBUF ) { rfp->_iobuf.dsize = bufsize - rfp->_iobuf.hsize; rfp->_iobuf.count = 0; rfp->_iobuf.ptr = iodata(rfp) ; } if ( (pw = Cgetpwuid(geteuid()) ) == NULL ) { save_errno = errno; save_serrno = serrno; TRACE(2, "rfio" ,"rfio_open64_ext_v3: Cgetpwuid() error %s",strerror(errno)); rfio_cleanup_v3(rfp->s); END_TRACE(); serrno = save_serrno; errno = save_errno; return -1 ; } /* * Building and sending request. */ /* if ((account = getacct()) == NULL) */ account = ""; TRACE(2,"rfio","rfio_open64_ext_v3: uid %d gid %d umask %o ftype %d, mode 0%o, flags 0%o", rfp->uid,rfp->gid,rfp->umask,rfp->ftype,mode,flags) ; TRACE(2,"rfio","rfio_open64_ext_v3: account: %s",account) ; TRACE(2,"rfio","rfio_open64_ext_v3: filename: %s",filename) ; if (reqhost != NULL && strlen(reqhost) ) TRACE(2,"rfio","rfio_open64_ext_v3: requestor's host: %s",reqhost) ; p= rfio_buf ; len= 5*WORDSIZE + 3*LONGSIZE + strlen(account) + strlen(filename) + strlen(pw->pw_name) + strlen(reqhost) + 4 ; marshall_WORD(p,RFIO_MAGIC) ; marshall_WORD(p,RQST_OPEN64_V3) ; marshall_LONG(p,len) ; p= rfio_buf + RQSTSIZE ; marshall_WORD(p,rfp->uid) ; marshall_WORD(p,rfp->gid) ; marshall_WORD(p,rfp->umask) ; marshall_WORD(p,FFTYPE_C) ; marshall_LONG(p,htonopnflg(flags)) ; marshall_LONG(p,mode) ; marshall_STRING(p,account) ; marshall_STRING(p,filename) ; marshall_STRING(p,pw->pw_name) ; marshall_STRING(p,reqhost) ; marshall_LONG(p,rfp->passwd); marshall_WORD(p,rfp->mapping); TRACE(2,"rfio","rfio_open64_v3: sending %d bytes",RQSTSIZE+len) ; save_serrno = serrno; serrno = 0; save_errno = errno; errno = 0; if (netwrite_timeout(rfp->s,rfio_buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { save_errno = errno; save_serrno = serrno; TRACE(2,"rfio","rfio_open64_v3: write(): ERROR occured (errno=%d)", errno) ; syslog(LOG_ALERT, "rfio: open64_v3: %s (error %d , serrno %d with %s) [uid=%d,gid=%d,pid=%d] in netwrite(%d,0X%X,%d)", strerror(errno > 0 ? errno : serrno), errno, serrno, rfp->host, rfp->uid, rfp->gid, getpid(), rfp->s, rfio_buf, RQSTSIZE+len); rfio_cleanup_v3(rfp->s) ; END_TRACE() ; serrno = save_serrno; errno = save_errno; return -1 ; } serrno = save_serrno; errno = save_errno; /* * Getting status and current offset. */ TRACE(1, "rfio", "rfio_open64_v3: reading %d bytes",rfp->_iobuf.hsize) ; save_serrno = serrno; serrno = 0; save_errno = errno; errno = 0; /* * We need to increase the timeout on this netread() because if we * miss this message the server will hang forever (it will be stuck * in an accept() on the data socket). A better solution on the * server side is needed to more properly cope with this problem. */ rlen = RQSTSIZE+HYPERSIZE; if ((rb = netread_timeout(rfp->s,rfio_buf,rlen,10*RFIO_CTRL_TIMEOUT)) != rlen ) { save_errno = errno; save_serrno = serrno; #if !defined(_WIN32) if (rb == 0 || (rb < 0 && errno == ECONNRESET)) { #else if (rb == 0 || (rb < 0 && serrno == SETIMEDOUT)) { #endif TRACE(2, "rfio", "rfio_open64_v3: read(): The connection with the server has been broken"); } else { TRACE(2, "rfio", "rfio_open64_v3: read(): ERROR %d occured (errno=%d, serrno=%d)", rb, errno, serrno); syslog(LOG_ALERT, "rfio: open64_v3: %s (error %d, serrno %d with %s) [uid=%d,gid=%d,pid=%d] in netread(%d,0X%X,%d)", strerror(errno > 0 ? errno : serrno), errno, serrno, rfp->host, rfp->uid, rfp->gid, getpid(), rfp->s, rfio_buf, rlen); } rfio_cleanup_v3(rfp->s); END_TRACE(); serrno = save_serrno; errno = save_errno; return(-1); } serrno = save_serrno; errno = save_errno; p= rfio_buf ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; unmarshall_LONG(p, data_port); unmarshall_HYPER(p, offset); TRACE(1,"rfio","rfio_open64_v3: return status(%d), rcode(%d), offset %s fd: %d", status, rcode, u64tostr(offset,tmpbuf,0), rfp->s) ; /* will have to check if server doesn't support OPEN_V3 */ if ( status < 0 ) { if ( rcode >= SEBASEOFF) serrno = rcode ; else rfio_errno= rcode ; rfio_cleanup_v3(rfp->s) ; /* Operation failed but no error message was sent */ if ( rcode == 0 ) serrno = SENORCODE ; END_TRACE() ; return -1 ; } else { rfp->offset64= offset ; } /* use the remote address of the control connection, * but change to the data_port number */ switch(to.ss_family) { case AF_INET: ((struct sockaddr_in *)&to)->sin_port = htons(data_port); break; case AF_INET6: ((struct sockaddr_in6 *)&to)->sin6_port = htons(data_port); break; default: TRACE(2,"rfio","unknown address family: %d",to.ss_family); rfio_cleanup_v3(rfp->s); END_TRACE() ; #if defined(_WIN32) WSASetLastError(WSAEAFNOSUPPORT); #else errno = EAFNOSUPPORT; #endif return (-1); } /* lseekhow field contains the fd of the data socket */ /* Add error checking here ! (-1)*/ rfp->lseekhow = data_rfio_connect((struct sockaddr *)&to,tolen,host,&rem,flags); /* In case of network errors, abort */ if (rfp->lseekhow == -1) { save_errno = errno; save_serrno = serrno; rfio_cleanup_v3(rfp->s) ; END_TRACE() ; serrno = save_serrno; errno = save_errno; return -1 ; } /* Set the keepalive option on both sockets */ yes = 1; if (setsockopt(rfp->lseekhow,SOL_SOCKET,SO_KEEPALIVE,(char *)&yes, sizeof(yes)) < 0) { TRACE(2,"rfio","open64_v3: setsockopt keepalive on data: %s",strerror(errno)); } TRACE(2,"rfio","open64_v3: setsockopt keepalive on data done"); #if (defined(__osf__) && defined(__alpha) && defined(DUXV4)) /* Set the keepalive interval to 20 mns instead of the default 2 hours */ yes = 20 * 60; if (setsockopt(rfp->lseekhow,IPPROTO_TCP,TCP_KEEPIDLE,(char *)&yes,sizeof(yes)) < 0) { TRACE(2,"rfio","open64_v3: setsockopt keepidle on data: %s",strerror(errno)); } TRACE(2,"rfio","open64_v3: setsockopt keepidle on data done (%d s)",yes); #endif #if !(defined(__osf__) && defined(__alpha) && defined(DUXV4)) yes = 1; if (setsockopt(rfp->lseekhow,IPPROTO_TCP,TCP_NODELAY,(char *)&yes,sizeof(yes)) < 0) { TRACE(2,"rfio","open64_v3: setsockopt nodelay on data: %s",strerror(errno)); } TRACE(2,"rfio","open64_v3: setsockopt nodelay option set on data socket"); #endif /* !(defined(__osf__) && defined(__alpha) && defined(DUXV4)) */ #if defined (CLIENTLOG) /* Client logging */ rfio_logop(rfp->s,filename,host,flags); #endif /* * The file is open, update rfp->fp */ #if defined(hpux) rfp->fp.__fileL = rfp->s; #else #if defined(linux) rfp->fp._fileno = rfp->s; #else #if defined(__Lynx__) rfp->fp._fd = rfp->s; #else rfp->fp._file = rfp->s; #endif /* __Lynx__ */ #endif /* linux */ #endif /* hpux */ END_TRACE() ; return (rfp->s) ; } void rfio_setup64_v3(iop) RFILE *iop; { (void)rfio_setup64_ext_v3(iop,0,0,0); } /* * Remote file read */ int DLL_DECL rfio_read64_v3(ctrl_sock, ptr, size) char *ptr; int ctrl_sock, size; { int status ; /* Return code of called func */ int HsmType, save_errno; char * p ; /* Pointer to buffer */ fd_set fdvar; struct timeval t; int req; char *iobuffer; int byte_in_buffer; int n; char rqstbuf[BUFSIZ]; char rfio_buf[BUFSIZ]; int ctrl_sock_index; char tmpbuf[21]; /* Avoiding Valgrind error messages about uninitialized data */ memset(rfio_buf, 0, BUFSIZ); INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_read64_v3(%d, %x, %d)", ctrl_sock, ptr, size) ; if (size == 0) { END_TRACE(); return(0); } #if defined (CLIENTLOG) /* Client logging */ rfio_logrd(ctrl_sock,size); #endif /* * Check HSM type. The CASTOR HSM uses normal RFIO (local or remote) * to perform the I/O. Thus we don't call rfio_HsmIf_read(). */ HsmType = rfio_HsmIf_GetHsmType(ctrl_sock,NULL); if ( HsmType > 0 ) { if ( HsmType != RFIO_HSM_CNS ) { status = rfio_HsmIf_read(ctrl_sock,ptr,size); if ( status == -1 ) { save_errno = errno; rfio_HsmIf_IOError(ctrl_sock,errno); errno = save_errno; } END_TRACE(); return(status); } } /* * The file is local. */ if ((ctrl_sock_index = rfio_rfilefdt_findentry(ctrl_sock,FINDRFILE_WITHOUT_SCAN)) == -1) { TRACE(2, "rfio", "rfio_read64_v3: using local read(%d, %x, %d)", ctrl_sock, ptr, size); status = read(ctrl_sock, ptr, size); if ( HsmType == RFIO_HSM_CNS ) { save_errno = errno; rfio_HsmIf_IOError(ctrl_sock,errno); errno = save_errno; } END_TRACE(); rfio_errno = 0; return(status); } /* * Checking magic number. */ if (rfilefdt[ctrl_sock_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(ctrl_sock_index); (void) close(ctrl_sock) ; END_TRACE(); return(-1); } /* * Checking mode 64. */ if (!rfilefdt[ctrl_sock_index]->mode64) { status = rfio_read_v3(ctrl_sock, ptr, size); END_TRACE(); return(status); } if (rfilefdt[ctrl_sock_index]->first_read) { rfilefdt[ctrl_sock_index]->first_read = 0; rfilefdt[ctrl_sock_index]->eof_received = 0; /* * Sending request using control socket. */ p = rfio_buf; marshall_WORD(p,RFIO_MAGIC); marshall_WORD(p,RQST_READ64_V3); TRACE(2, "rfio", "rfio_read64_v3: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(ctrl_sock, rfio_buf, RQSTSIZE, RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2,"rfio","rfio_read64_v3: write(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } TRACE(2,"rfio", "rfio_read64_v3: reading %d bytes",RQSTSIZE) ; if ((n = netread_timeout(ctrl_sock,rqstbuf,RQSTSIZE,RFIO_CTRL_TIMEOUT)) != RQSTSIZE) { if (n == 0) TRACE(2, "rfio","read64_v3 ctrl socket: read(): %s\n", sstrerror(serrno)); else TRACE(2, "rfio","read64_v3 ctrl socket: read(): %s\n", strerror(errno)); END_TRACE(); return -1 ; } p = rqstbuf; unmarshall_WORD(p,req) ; unmarshall_HYPER(p,rfilefdt[ctrl_sock_index]->filesize64) ; TRACE(2,"rfio", "rfio_read64_v3: filesize is %s bytes", u64tostr(rfilefdt[ctrl_sock_index]->filesize64,tmpbuf,0)) ; } iobuffer = ptr; byte_in_buffer = 0; while (1) { /* EOF received previously but not all data read */ if (rfilefdt[ctrl_sock_index]->eof_received && rfilefdt[ctrl_sock_index]->filesize64 == rfilefdt[ctrl_sock_index]->rdbyte_net64) { /* End of file and all data has been read by the client */ TRACE(2,"rfio","rfio_read64_v3: request satisfied eof encountered (read returns %d)",byte_in_buffer); END_TRACE(); return(byte_in_buffer); } FD_ZERO(&fdvar); /* Bother of ctrl socket till eof has not been received */ if (!rfilefdt[ctrl_sock_index]->eof_received) FD_SET(ctrl_sock,&fdvar); FD_SET(rfilefdt[ctrl_sock_index]->lseekhow,&fdvar); t.tv_sec = 30; t.tv_usec = 0; TRACE(2,"rfio","read64_v3: doing select") ; if (select(FD_SETSIZE,&fdvar,NULL,NULL,&t) < 0) { TRACE(2,"rfio","read64_v3: select failed (errno=%d)",errno) ; END_TRACE() ; return -1 ; } if (FD_ISSET(ctrl_sock,&fdvar)) { int cause,rcode; int n; char rqstbuf[BUFSIZ]; /* Something received on the control socket */ TRACE(2,"rfio", "read64_v3: ctrl socket: reading %d bytes", RQSTSIZE) ; n = netread_timeout(ctrl_sock, rqstbuf, RQSTSIZE, RFIO_CTRL_TIMEOUT); if (n != RQSTSIZE) { if (n == 0) { TRACE(2, "rfio","read64_v3: read ctrl socket: close received"); END_TRACE() ; return(-1); } else { TRACE(2, "rfio","read64_v3: read ctrl socket: read(): %s", strerror(errno)); END_TRACE() ; return -1 ; } } p = rqstbuf; unmarshall_WORD(p,cause) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p,rcode) ; if (cause == REP_ERROR) { TRACE(2,"rfio", "read64_v3: reply error status %d, rcode %d", status, rcode) ; rfio_errno = rcode; TRACE(2,"rfio","read64_v3: sending ack for error") ; n = netwrite_timeout(ctrl_sock, rqstbuf, RQSTSIZE, RFIO_CTRL_TIMEOUT); if (n != RQSTSIZE) { TRACE(2,"rfio","read64_v3: write(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } if ( HsmType == RFIO_HSM_CNS ) rfio_HsmIf_IOError(ctrl_sock,(rfio_errno > 0 ? rfio_errno : serrno)); END_TRACE(); return(-1); } if (cause == REP_EOF) { rfilefdt[ctrl_sock_index]->eof_received = 1; TRACE(2,"rfio", "read64_v3: eof received") ; if (rfilefdt[ctrl_sock_index]->filesize64 == rfilefdt[ctrl_sock_index]->rdbyte_net64) { /* End of file and all data has been read by the client */ TRACE(2,"rfio","rfio_read64_v3: request satisfied eof encountered (read returns %d)", byte_in_buffer); END_TRACE(); return(byte_in_buffer); } } } if (FD_ISSET(rfilefdt[ctrl_sock_index]->lseekhow,&fdvar)) { /* Receiving data using data socket */ /* Do not use read here because NT doesn't support that with socket fds */ n = s_nrecv(rfilefdt[ctrl_sock_index]->lseekhow, iobuffer, size-byte_in_buffer); if (n <= 0) { if (n == 0) { TRACE(2,"rfio","read64_v3: datasoket %d closed by remote end", rfilefdt[ctrl_sock_index]->lseekhow) ; END_TRACE() ; return(-1); } else { TRACE(2,"rfio","read64_v3: datasoket %d read(): ERROR occured (errno=%d)", rfilefdt[ctrl_sock_index]->lseekhow, errno) ; END_TRACE() ; return -1 ; } } byte_in_buffer += n; rfilefdt[ctrl_sock_index]->rdbyte_net64 += n; iobuffer += n; TRACE(2,"rfio","read64_v3: receiving datasocket=%d bytes,buffer=%d,req=%d", n, byte_in_buffer, size) ; if (byte_in_buffer == size) { TRACE(2,"rfio","read64_v3: request satisfied completely"); ; END_TRACE(); return(size); } } /* End of FD_ISSET(rfilefdt[ctrl_sock_index]->lseekhow,&fdvar) */ } } /* * Remote file write */ int DLL_DECL rfio_write64_v3(ctrl_sock, ptr, size) char *ptr; int ctrl_sock, size; { int status ; /* Return code of called func */ int HsmType, save_errno, written_to; char * p ; /* Pointer to buffer */ fd_set fdvar; struct timeval t; char rfio_buf[BUFSIZ]; int ctrl_sock_index; /* Avoiding Valgrind error messages about uninitialized data */ memset(rfio_buf, 0, BUFSIZ); INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_write64_v3(%d, %x, %d)", ctrl_sock, ptr, size) ; if (size == 0) { END_TRACE(); return(size); } #if defined (CLIENTLOG) /* Client logging */ rfio_logwr(ctrl_sock,size); #endif /* * Check HSM type and if file has been written to. The CASTOR HSM * uses normal RFIO (local or remote) to perform the I/O. Thus we * don't call rfio_HsmIf_write(). */ HsmType = rfio_HsmIf_GetHsmType(ctrl_sock,&written_to); if ( HsmType > 0 ) { if ( written_to == 0 && (status = rfio_HsmIf_FirstWrite(ctrl_sock,ptr,size)) < 0 ) { END_TRACE(); return(status); } if ( HsmType != RFIO_HSM_CNS ) { status = rfio_HsmIf_write(ctrl_sock,ptr,size); if ( status == -1 ) rfio_HsmIf_IOError(ctrl_sock,errno); END_TRACE(); return(status); } } /* * The file is local. */ if ((ctrl_sock_index = rfio_rfilefdt_findentry(ctrl_sock,FINDRFILE_WITHOUT_SCAN)) == -1) { TRACE(2, "rfio", "rfio_write64_v3: using local write(%d, %x, %d)", ctrl_sock, ptr, size); status = write(ctrl_sock, ptr, size); if ( HsmType == RFIO_HSM_CNS ) { save_errno = errno; rfio_HsmIf_IOError(ctrl_sock,errno); errno = save_errno; } END_TRACE(); rfio_errno = 0; return(status); } /* * Checking magic number. */ if (rfilefdt[ctrl_sock_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(ctrl_sock_index); (void) close(ctrl_sock) ; END_TRACE(); return(-1); } /* * Checking mode 64. */ if (!rfilefdt[ctrl_sock_index]->mode64) { status = rfio_write_v3(ctrl_sock, ptr, size); END_TRACE(); return(status); } if (rfilefdt[ctrl_sock_index]->first_write) { rfilefdt[ctrl_sock_index]->first_write = 0; /* * Sending request using control socket. */ p = rfio_buf; marshall_WORD(p,RFIO_MAGIC); marshall_WORD(p,RQST_WRITE64_V3); TRACE(2, "rfio", "rfio_write64_v3: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(ctrl_sock, rfio_buf, RQSTSIZE, RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2,"rfio","rfio_write64_v3: write(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } } FD_ZERO(&fdvar); FD_SET(ctrl_sock,&fdvar); t.tv_sec = 0; t.tv_usec = 0; TRACE(2,"rfio","write64_v3: doing select"); /* Immediate return here to send data as fast as possible */ if (select(FD_SETSIZE,&fdvar,NULL,NULL,&t) < 0) { TRACE(2,"rfio","write64_v3: select failed (errno=%d)",errno) ; END_TRACE() ; return -1 ; } if (FD_ISSET(ctrl_sock,&fdvar)) { int cause,rcode; int n; char rqstbuf[BUFSIZ]; /* Avoiding Valgrind error messages about uninitialized data */ memset(rqstbuf, 0, BUFSIZ); /* Something received on the control socket */ TRACE(2,"rfio", "write64_v3: ctrl socket: reading %d bytes",RQSTSIZE) ; if ((n = netread_timeout(ctrl_sock,rqstbuf,RQSTSIZE,RFIO_CTRL_TIMEOUT)) != RQSTSIZE) { if (n == 0) TRACE(2, "rfio","write64_v3: read ctrl socket: read(): %s\n", sstrerror(serrno)); else TRACE(2, "rfio","write64_v3: read ctrl socket: read(): %s\n", strerror(errno)); END_TRACE(); return -1 ; } p = rqstbuf; unmarshall_WORD(p,cause) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p,rcode) ; if (cause == REP_ERROR) TRACE(2,"rfio", "write64_v3: reply error status %d, rcode %d", status, rcode) ; else TRACE(2,"rfio", "write64_v3: unknown error status %d, rcode %d", status, rcode) ; rfio_errno = rcode; TRACE(2,"rfio","write64_v3: sending ack for error") ; if (netwrite_timeout(ctrl_sock, rqstbuf, RQSTSIZE, RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2,"rfio","write64_v3: write(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } if ( status < 0 ) rfio_HsmIf_IOError(ctrl_sock,rfio_errno); END_TRACE(); return(-1); } /* Sending data using data socket */ TRACE(2,"rfio","write64_v3: sending %d bytes to datasocket filedesc=%d", size,rfilefdt[ctrl_sock_index]->lseekhow) ; if (netwrite_timeout(rfilefdt[ctrl_sock_index]->lseekhow, ptr, size, RFIO_DATA_TIMEOUT) != size) { TRACE(2,"rfio","write64_v3: data write(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } rfilefdt[ctrl_sock_index]->wrbyte_net64 += size; END_TRACE(); return(size); } /* Close part */ /* * remote file close */ int DLL_DECL rfio_close64_v3(s) int s; { int req; char *p ; struct { unsigned int rcount; /* read() count */ unsigned int wcount; /* write() count */ off64_t rbcount; /* byte(s) read */ off64_t wbcount; /* byte(s) written */ } iostatbuf ; int rcode,status,status1,HsmType; struct timeval t; fd_set fdvar; unsigned char *dummy; int sizeofdummy = 128 * 1024; int n; char rfio_buf[BUFSIZ]; int s_index; int eod = 0; /* Close received on data socket*/ int save_errno; /* Avoiding Valgrind error messages about uninitialized data */ memset(rfio_buf, 0, BUFSIZ); INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_close64_v3(%d)", s); /* * Check if file is Hsm. For CASTOR HSM files, the file is * closed using normal RFIO (local or remote) close(). */ HsmType = rfio_HsmIf_GetHsmType(s,NULL); if ( HsmType > 0 && HsmType != RFIO_HSM_CNS ) { status = rfio_HsmIf_close(s); END_TRACE() ; return(status); } /* * The file is local */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1) { char r_token[CA_MAXDPMTOKENLEN+1]; char upath[CA_MAXHOSTNAMELEN+CA_MAXPATHLEN+2]; if ( HsmType == RFIO_HSM_CNS ) status1 = rfio_HsmIf_getipath(s,upath,r_token); TRACE(2, "rfio", "rfio_close64_v3: using local close(%d)",s) ; status= close(s) ; save_errno = errno; #if defined (CLIENTLOG) /* Client logging */ rfio_logcl(s); #endif if ( HsmType == RFIO_HSM_CNS ) { if ( status1 == 1 ) status1 = rfio_HsmIf_reqtoput(upath,r_token); if ( status1 == 0 ) errno = save_errno; } else status1 = 0; END_TRACE() ; rfio_errno = 0; return (status ? status : status1) ; } /* * Checking mode 64. */ if (!rfilefdt[s_index]->mode64) { status = rfio_close_v3(s); END_TRACE() ; return(status); } #if defined (CLIENTLOG) /* Client logging */ rfio_logcl(s); #endif /* * Checking magic number */ if ( rfilefdt[s_index]->magic != RFIO_MAGIC ) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(s_index); (void) close(s) ; END_TRACE(); return(-1); } /* * Sending request. */ p= rfio_buf ; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_CLOSE64_V3); marshall_HYPER(p, rfilefdt[s_index]->wrbyte_net64); TRACE(2, "rfio", "rfio_close64_v3: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(s, rfio_buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio", "rfio_close64_v3: write(): ERROR occured (errno=%d)", errno); (void) rfio_cleanup_v3(s) ; END_TRACE() ; return -1 ; } while (1) { FD_ZERO(&fdvar); FD_SET(s,&fdvar); if ( rfilefdt[s_index]->lseekhow != INVALID_SOCKET && eod == 0) FD_SET(rfilefdt[s_index]->lseekhow,&fdvar); t.tv_sec = 10; t.tv_usec = 0; TRACE(2,"rfio","close64_v3: doing select") ; if (select(FD_SETSIZE,&fdvar,NULL,NULL,&t) < 0) { TRACE(2,"rfio","close64_v3: select failed (errno=%d)",errno) ; END_TRACE() ; return -1 ; } /* CLOSE confirmation received from server */ if (FD_ISSET(s,&fdvar)) { /* * Getting data from the network. */ TRACE(2, "rfio", "rfio_close64_v3: reading %d bytes",RQSTSIZE) ; if ((n = netread_timeout(s,rfio_buf,RQSTSIZE,RFIO_CTRL_TIMEOUT)) != RQSTSIZE) { if (n == 0) TRACE(2, "rfio", "rfio_close64_v3: read(): ERROR occured (serrno=%d)", serrno); else TRACE(2, "rfio", "rfio_close64_v3: read(): ERROR occured (errno=%d)", errno); (void)rfio_cleanup_v3(s) ; END_TRACE() ; return -1 ; } /* Closing data socket after the server has read all the data */ TRACE(2, "rfio", "rfio_close64_v3 closing data socket, fildesc=%d", rfilefdt[s_index]->lseekhow) ; if (rfilefdt[s_index]->lseekhow != INVALID_SOCKET && s_close(rfilefdt[s_index]->lseekhow) < 0) TRACE(2, "rfio", "rfio_close64_v3: close(): ERROR occured (errno=%d)", errno); rfilefdt[s_index]->lseekhow = INVALID_SOCKET; p = rfio_buf ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; rfio_errno = rcode ; switch(req) { case RQST_CLOSE64_V3: (void) rfio_cleanup_v3(s) ; TRACE(1, "rfio", "rfio_close64_v3: return status=%d, rcode=%d",status,rcode) ; END_TRACE() ; return status ; case REP_ERROR: /* It is possible to receive an error reply from the server write64_v3 routine */ /* This is a bug fix for the internal rfio error returned by close64_v3 when write64_v3 on the server side returns 'not enough space' while the client has executing the close64_v3 routine */ (void) rfio_cleanup_v3(s) ; TRACE(1, "rfio", "rfio_close64_v3: return status=%d, rcode=%d",status,rcode) ; if ( status < 0 ) rfio_HsmIf_IOError(s,rcode); END_TRACE() ; return status ; case REP_EOF: /* If we read exactly the amount of data in the file */ TRACE(1, "rfio", "rfio_close64_v3: received REP_EOF at close."); continue; default: TRACE(1,"rfio","rfio_close64_v3(): Bad control word received") ; serrno= SEINTERNAL ; (void) rfio_cleanup_v3(s) ; END_TRACE() ; return -1 ; } } /* Server is still sending data through data socket */ /* Reading data socket to unstuck the server which then will be able to handle the CLOSE request we have sent previously */ if (FD_ISSET(rfilefdt[s_index]->lseekhow,&fdvar)) { TRACE(2, "rfio", "rfio_close64_v3: emptying data socket") ; dummy = (unsigned char *)malloc(sizeof(unsigned char) * sizeofdummy); if (dummy == NULL) { TRACE(2,"rfio","rfio_close64_v3(): Cannot allocate memory") ; (void) rfio_cleanup_v3(s) ; END_TRACE() ; return -1 ; } /* Do not use read here as NT doesn't support this with socket fds */ if ((n = s_nrecv(rfilefdt[s_index]->lseekhow, dummy, sizeofdummy)) <= 0) { if (n < 0) /* 0 = continue (data socket closed, waiting for close ack */ { TRACE(2,"rfio","close64_v3: read failed (errno=%d)",errno) ; (void) rfio_cleanup_v3(s) ; END_TRACE() ; return -1 ; } else if (n == 0) { TRACE(2, "rfio","rfio_close64_v3: close received on data socket %d", rfilefdt[s_index]->lseekhow); eod = 1; } else { /* n > 0 */ TRACE(2, "rfio", "rfio_close64_v3: emptying data socket, %d bytes read from data socket",n) ; } } free(dummy); } } } /* * lseek for RFIO version 3 transfers * Must be called only between an open (version 3) * and the first read or write system call */ off64_t rfio_lseek64_v3(s, offset, how) int s; off64_t offset; int how; { char *p; off64_t offset64_out; char rfio_buf[BUFSIZ]; int rep; int status,rcode; int s_index; char tmpbuf[21]; INIT_TRACE("RFIO_TRACE") ; TRACE(1, "rfio", "rfio_lseek64_v3(%d,%s,%x)",s,i64tostr(offset,tmpbuf,0),how); #if defined(CLIENTLOG) /* Client logging */ rfio_logls(s,offset,how); #endif /* CLIENTLOG */ /* * The file is local */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1) { TRACE(2, "rfio", "rfio_lseek64_v3: using local lseek(%d,%s,%d)",s,i64tostr(offset,tmpbuf,0),how) ; offset64_out = lseek64(s,offset,how); rfio_errno = 0; END_TRACE(); return offset64_out; } /* * Checking mode 64. */ if (!rfilefdt[s_index]->mode64) { int offsetout; int offsetin; off64_t off64; offsetin = offset; offsetout = rfio_lseek_v3(s, offsetin, how ); off64 = offsetout; END_TRACE(); return(off64); } /* * Checking 'how' parameter. */ if (how != SEEK_SET) { errno = EINVAL; END_TRACE(); return -1; } /* * Checking magic number */ if (rfilefdt[s_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION; rfio_rfilefdt_freeentry(s_index); (void) close(s); END_TRACE(); return -1; } /* * Sending request. */ p = rfio_buf; marshall_WORD(p,RFIO_MAGIC); marshall_WORD(p,RQST_LSEEK64_V3); marshall_HYPER(p,offset); marshall_LONG(p,how); TRACE(2, "rfio", "rfio_lseek64_v3: sending %d bytes",RQSTSIZE); if (netwrite_timeout(s,rfio_buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio", "rfio_lseek64_v3: write(): ERROR occured (errno=%d)", errno); END_TRACE(); return -1; } /* * Receiving reply * */ TRACE(2, "rfio", "rfio_lseek64_v3: reading %d bytes",RQSTSIZE); if (netread_timeout(s,rfio_buf,WORDSIZE+HYPERSIZE+LONGSIZE,RFIO_DATA_TIMEOUT) != WORDSIZE+HYPERSIZE+LONGSIZE) { TRACE(2,"rfio","rfio_lseek64_v3: read(): ERROR occured (errno=%d)",errno); END_TRACE(); return -1; } p = rfio_buf; unmarshall_WORD(p,rep); unmarshall_HYPER(p,offset64_out); unmarshall_LONG(p,rcode); if (rep != RQST_LSEEK64_V3) { TRACE(1,"rfio","rfio_lseek64_v3(): Bad control word received\n"); serrno = SEINTERNAL; END_TRACE(); return -1; } if (offset64_out < 0) rfio_errno = rcode; TRACE(1,"rfio","rfio_lseek64_v3: rep %x, offset64_out %s, rcode %d", rep,u64tostr(offset64_out,tmpbuf,0),rcode) ; END_TRACE(); return offset64_out; } lcgdm-1.10.0/rfio/rfio_ftello64.man0000644000175000017500000000021510222773541016332 0ustar ellertellert.so ./rfio_ftell.man .\" @(#)$RCSfile: rfio_ftello64.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:02 $ CERN IT-PDP/DM Jean-Philippe Baud lcgdm-1.10.0/rfio/fseeko64.c0000644000175000017500000000401411533400617014747 0ustar ellertellert/* * $Id: fseeko64.c 4148 2011-03-02 08:36:31Z baud $ */ /* * Copyright (C) 1998-2011 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: fseeko64.c,v $ $Revision: 4148 $ $Date: 2011-03-02 09:36:31 +0100 (Wed, 02 Mar 2011) $ CERN/IT/PDP/DM Fabien Collin, Philippe Gaillardon"; #endif /* not lint */ /* fseeko64.c Remote File I/O - fseek library call */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rfilefdt.h" #include "u64subr.h" #include /* * Remote file fseek */ int DLL_DECL rfio_fseeko64(fp, offset, whence) RFILE *fp; off64_t offset; int whence; { int rc; off64_t offsetout; char tmpbuf[21]; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_fseeko64(%x, %s, %d)", fp, u64tostr(offset,tmpbuf,0), whence); /* * Checking fp validity */ if (fp == NULL) { errno = EBADF; TRACE(2,"rfio","rfio_fseeko64() : FILE ptr is NULL "); END_TRACE(); return -1; } if (rfio_rfilefdt_findptr(fp,FINDRFILE_WITH_SCAN) == -1) { TRACE(2,"rfio","rfio_fseeko64() : using local fseeko64() "); rc = fseeko64((FILE *)fp, offset, whence); if ( rc < 0 ) serrno = 0; rfio_errno = 0; END_TRACE(); return rc; } TRACE(2,"rfio","rfio_fseeko64() : after remoteio") ; /* * Checking magic number */ if (fp->magic != RFIO_MAGIC) { int fps = fp->s; serrno = SEBADVERSION; TRACE(2, "rfio", "rfio_fseeko64() : Bad magic number"); free((char *)fp); (void) close(fps); END_TRACE(); return -1; } /* * The file is remote */ offsetout = rfio_lseek64(fp->s, offset, whence); if ( offsetout == (off64_t)-1 ) { rc = -1; #ifdef linux ((RFILE *)fp)->eof |= _IO_ERR_SEEN; #else #if defined( __APPLE__) ((RFILE *)fp)->eof |= __SERR; #else #ifdef __Lynx__ ((RFILE *)fp)->eof |= _ERR; #else ((RFILE *)fp)->eof |= _IOERR; #endif #endif #endif } else { rc = 0; } END_TRACE(); return rc; } lcgdm-1.10.0/rfio/lseek64.c0000644000175000017500000003227311540363064014610 0ustar ellertellert/* * $Id: lseek64.c 4202 2011-03-17 10:45:08Z baud $ */ /* * Copyright (C) 1990-2011 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: lseek64.c,v $ $Revision: 4202 $ $Date: 2011-03-17 11:45:08 +0100 (Thu, 17 Mar 2011) $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy, P. Gaillardon"; #endif /* not lint */ /* lseek64.c Remote File I/O - move read/write file mark. */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rfilefdt.h" #include "u64subr.h" #include /* malloc prototype */ /* * Forward declaration. */ static off64_t rfio_lseekinbuf64(int s, off64_t offset) ; static off64_t rfio_forcelseek64(int s, off64_t offset, int how) ; /* * Remote file seek */ off64_t DLL_DECL rfio_lseek64(s, offset, how) int s ; off64_t offset ; int how ; { int status ; off64_t offsetout; int s_index = -1; char tmpbuf[21]; INIT_TRACE("RFIO_TRACE") ; TRACE(1,"rfio","rfio_lseek64(%d, %s, %x)",s,i64tostr(offset,tmpbuf,0),how) ; #if defined(CLIENTLOG) /* Client logging */ rfio_logls(s,offset,how); #endif /* CLIENTLOG */ /* * The file is local */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1 ) { TRACE(2, "rfio", "rfio_lseek64: using local lseek64(%d, %s, %d)",s,i64tostr(offset,tmpbuf,0),how) ; offsetout = lseek64(s,offset,how) ; if ( offsetout < 0 ) serrno = 0; END_TRACE(); rfio_errno = 0; return offsetout ; } /* * Checking 'how' parameter. */ if ( how < 0 || how > 2 ) { errno= EINVAL ; END_TRACE(); return -1 ; } /* * Checking 'offset' parameter. */ if ( offset < 0 && how == SEEK_SET ) { errno= EINVAL ; END_TRACE(); return -1 ; } /* * Checking magic number */ if ( rfilefdt[s_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(s_index); (void) close(s); END_TRACE(); return -1 ; } /* * Checking mode 64. */ if (!rfilefdt[s_index]->mode64) { int off32in; int off32out; if (offset > (off64_t)2147483647 ) { errno = EFBIG; END_TRACE(); return ((off64_t)-1); } off32in = offset; off32out = rfio_lseek(s, off32in, how); END_TRACE(); return((off64_t)off32out); } /* If RFIO version 3 enabled, then call the corresponding procedure */ if (rfilefdt[s_index]->version3 == 1) { offsetout = rfio_lseek64_v3(s,offset,how); END_TRACE(); return(offsetout); } /* * Changing SEEK_CUR in SEEK_SET. * WARNING !!! Should not be removed. */ if ( how == SEEK_CUR ) { how = SEEK_SET ; offset += rfilefdt[s_index]->offset64 ; } /* * A preseek() is active. */ if ( rfilefdt[s_index]->preseek && how != SEEK_END ) { offsetout = rfio_lseekinbuf64(s,offset) ; END_TRACE() ; return offsetout ; } /* * If I/O are bufferized and * if the buffer is not empty. */ if ( rfilefdt[s_index]->_iobuf.base && rfilefdt[s_index]->_iobuf.count ) { if ( how != SEEK_END ) { if ( offset >= rfilefdt[s_index]->offset64 ) { if ( offset <= rfilefdt[s_index]->offset64 + rfilefdt[s_index]->_iobuf.count ) { /* * Data is currently in the buffer. */ rfilefdt[s_index]->_iobuf.count -= (offset - rfilefdt[s_index]->offset64) ; rfilefdt[s_index]->_iobuf.ptr += (offset - rfilefdt[s_index]->offset64) ; rfilefdt[s_index]->offset64 = offset ; END_TRACE() ; return offset ; } /* * Data should be in the next message. */ else if (rfilefdt[s_index]->readissued && (offset-rfilefdt[s_index]->offset64)<=(rfilefdt[s_index]->_iobuf.count+rfilefdt[s_index]->_iobuf.dsize)){ /* * Getting next message. */ rfilefdt[s_index]->offset64 += rfilefdt[s_index]->_iobuf.count ; rfilefdt[s_index]->_iobuf.ptr= iodata(rfilefdt[s_index]) ; rfilefdt[s_index]->_iobuf.count= 0 ; status= rfio_filbuf64(s,rfilefdt[s_index]->_iobuf.base,rfilefdt[s_index]->_iobuf.dsize) ; if ( status < 0 ) { rfilefdt[s_index]->readissued= 0 ; END_TRACE() ; return -1 ; } if ( status != rfilefdt[s_index]->_iobuf.dsize ) { rfilefdt[s_index]->eof= 1 ; rfilefdt[s_index]->readissued= 0 ; } rfilefdt[s_index]->_iobuf.count= status ; /* * Setting buffer pointers to the right place if possible. */ if ( (offset - rfilefdt[s_index]->offset64) <= rfilefdt[s_index]->_iobuf.count ) { rfilefdt[s_index]->_iobuf.count -= (offset - rfilefdt[s_index]->offset64) ; rfilefdt[s_index]->_iobuf.ptr += (offset - rfilefdt[s_index]->offset64) ; rfilefdt[s_index]->offset64 = offset ; END_TRACE() ; return offset ; } } } else { if ((rfilefdt[s_index]->offset64-offset)<=(rfilefdt[s_index]->_iobuf.dsize-rfilefdt[s_index]->_iobuf.count) && (rfilefdt[s_index]->offset64-offset)<=(rfilefdt[s_index]->_iobuf.ptr - rfilefdt[s_index]->_iobuf.base) ) { rfilefdt[s_index]->_iobuf.count += (rfilefdt[s_index]->offset64 - offset) ; rfilefdt[s_index]->_iobuf.ptr -= (rfilefdt[s_index]->offset64 - offset) ; rfilefdt[s_index]->offset64 = offset ; END_TRACE() ; return offset ; } } } /* how != SEEK_END */ } /* Non empty buffer */ rfilefdt[s_index]->lseekhow = how ; rfilefdt[s_index]->lseekoff64= offset ; if ( how == SEEK_END) { offsetout = rfio_forcelseek64(s,offset,how) ; if ( offset >= 0 ) rfilefdt[s_index]->eof = 1 ; rfilefdt[s_index]->offset64 = offsetout ; rfilefdt[s_index]->lseekhow = -1 ; rfilefdt[s_index]->lseekoff64 = offsetout ; } else { rfilefdt[s_index]->offset64 = offset ; /* * If RFIO are buffered, * data in cache is invalidated. */ if ( rfilefdt[s_index]->_iobuf.base ) { rfilefdt[s_index]->_iobuf.count=0; rfilefdt[s_index]->_iobuf.ptr = iodata(rfilefdt[s_index]) ; } } END_TRACE() ; return rfilefdt[s_index]->offset64 ; } /* * Action taken when a preseek() is active and rfio_lseek() is called. * Positionned pointers to the right record. */ static off64_t rfio_lseekinbuf64(s,offset) int s ; off64_t offset ; { char * p ; /* Pointer to buffer */ int s_index; char tmpbuf[21]; INIT_TRACE("RFIO_TRACE") ; TRACE(1,"rfio","rfio_lseekinbuf64(%d,%s)",s,i64tostr(offset,tmpbuf,0)) ; /* * Scanning records already requested. */ s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN); for(;;rfilefdt[s_index]->nbrecord -- ) { int status ; /* Status of the read() request */ int rcode ; /* Error code if any */ off64_t curoff ; /* Offset of the current record */ int len ; /* Length requested */ /* * The buffer is empty. */ if ( rfilefdt[s_index]->nbrecord == 0 ) { WORD req ; int msgsiz ; /* * No more data will arrive. */ if ( rfilefdt[s_index]->preseek == 2 ) break ; /* * Filling the buffer. */ msgsiz= rfilefdt[s_index]->_iobuf.hsize + rfilefdt[s_index]->_iobuf.dsize ; TRACE(2,"rfio","rfio_lseekinbuf64: reading %d bytes",msgsiz) ; if ( netread_timeout(s,rfilefdt[s_index]->_iobuf.base,msgsiz,RFIO_DATA_TIMEOUT) != msgsiz ) { TRACE(2,"rfio","rfio_lseekinbuf64: read() : ERROR occured (errno=%d)",errno) ; break ; } p= rfilefdt[s_index]->_iobuf.base ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p,rcode) ; unmarshall_LONG(p,msgsiz) ; rfio_errno= rcode ; /* * There is an error, * it did not work correctly. */ if ( status == -1 ) break ; /* * Resetting pointers. */ rfilefdt[s_index]->nbrecord= status ; rfilefdt[s_index]->_iobuf.ptr= iodata(rfilefdt[s_index]) ; rfilefdt[s_index]->preseek= (req == RQST_LASTSEEK) ? 2 : 1 ; } /* * The current record is the one we are looking for. */ p= rfilefdt[s_index]->_iobuf.ptr ; unmarshall_HYPER(p,curoff) ; unmarshall_LONG(p,len) ; TRACE(2,"rfio","rfio_lseekinbuf64: current record is at offset %s and of length %d", u64tostr(curoff,tmpbuf,0),len) ; if ( curoff <= offset && offset < curoff + len ) { rfilefdt[s_index]->offset64= offset ; END_TRACE() ; return offset ; } /* * Pointing to the next record. */ unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; if ( status > 0 ) rfilefdt[s_index]->_iobuf.ptr= p + status ; else rfilefdt[s_index]->_iobuf.ptr= p ; } /* * The offset requested in the preseek * does not appear in the preseek list. * an lseek() will be done with the next read(). */ rfilefdt[s_index]->nbrecord= 0 ; rfilefdt[s_index]->preseek= 0 ; rfilefdt[s_index]->lseekhow= SEEK_SET ; rfilefdt[s_index]->lseekoff64= offset ; rfilefdt[s_index]->offset64= offset ; END_TRACE() ; return offset ; } /* * Forcing remote lseek(). * Necessarry for SEEK_END lseek(). */ static off64_t rfio_forcelseek64(s, offset, how) int s ; off64_t offset ; int how ; { char * p ; /* Pointer to buffer */ char * trp ; /* Pointer to temporary buffer */ int temp=0 ; /* Is there a temporary buffer? */ char rfio_buf[BUFSIZ]; int s_index; WORD req ; int status ; int rcode ; int msgsiz ; /* dummy long word */ int rlen; /* reply buffer length */ off64_t offsetout; char tmpbuf[21]; INIT_TRACE("RFIO_TRACE") ; TRACE(1, "rfio", "rfio_forcelseek64(%d, %s, %x)", s, i64tostr(offset,tmpbuf,0), how) ; if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1) { serrno = SEINTERNAL; TRACE(2, "rfio", "rfio_lseek64: rfio_rfilefdt_findentry(): ERROR occured (serrno=%d)", serrno); END_TRACE() ; return -1 ; } if ( rfilefdt[s_index]->ahead ) rfilefdt[s_index]->readissued= 0 ; rfilefdt[s_index]->preseek= 0 ; rfilefdt[s_index]->nbrecord= 0 ; rfilefdt[s_index]->eof= 0 ; /* * If RFIO are buffered, * data in cache is invalidate. */ if ( rfilefdt[s_index]->_iobuf.base ) { rfilefdt[s_index]->_iobuf.count=0; rfilefdt[s_index]->_iobuf.ptr = iodata(rfilefdt[s_index]) ; } /* * Sending request. */ p= rfio_buf ; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_LSEEK64); marshall_HYPER(p, offset); marshall_LONG(p, how); TRACE(2, "rfio", "rfio_forcelseek64: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(s,rfio_buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio", "rfio_lseek64: write(): ERROR occured (errno=%d)", errno); END_TRACE() ; return ((off64_t)-1) ; } /* * Getting data from the network. */ rlen = rfilefdt[s_index]->_iobuf.hsize; for(;;) { TRACE(2, "rfio", "rfio_forcelseek64: reading %d bytes", rlen) ; if (netread_timeout(s, rfio_buf, rlen, RFIO_DATA_TIMEOUT) != rlen) { TRACE(2,"rfio","rfio_forcelseek64: read(): ERROR occured (errno=%d)",errno) ; if ( temp ) (void) free(trp) ; END_TRACE() ; return ((off64_t)-1) ; } p = rfio_buf ; unmarshall_WORD(p,req) ; switch(req) { case RQST_LSEEK64: unmarshall_HYPER(p, offsetout) ; unmarshall_LONG(p,rcode) ; rfio_errno = rcode ; if ( temp ) (void) free(trp) ; TRACE(1,"rfio","rfio_lseek64: offsetout %s, rcode %d", u64tostr(offsetout,tmpbuf,0),rcode) ; END_TRACE() ; return offsetout ; case RQST_READAHD64: case RQST_LASTSEEK: case RQST_PRESEEK64: unmarshall_LONG(p,status) ; unmarshall_LONG(p,rcode) ; unmarshall_LONG(p,msgsiz) ; /* * At this point a temporary buffer may need to be created * to receive data which is going to be thrown away. */ if ( temp == 0 ) { if ( rfilefdt[s_index]->_iobuf.base==NULL || rfilefdt[s_index]->_iobuf.dsize int rfio_feof(fp) RFILE * fp ; { int rc ; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_feof(%x)", fp); if ( fp == NULL ) { errno = EBADF; END_TRACE(); return -1 ; } /* * The file is local */ if (rfio_rfilefdt_findptr(fp,FINDRFILE_WITH_SCAN) == -1 ) { rc= feof((FILE *)fp) ; END_TRACE() ; rfio_errno = 0; return rc ; } /* * Checking magic number */ if ( fp->magic != RFIO_MAGIC) { int fps = fp->s; serrno = SEBADVERSION ; free((char *)fp); (void) close(fps) ; END_TRACE() ; return -1 ; } /* * The file is remote, using then the eof flag updated * by rfio_fread. */ #ifdef linux if ( ((RFILE *)fp)->eof & _IO_EOF_SEEN ) #else #if defined( __APPLE__) if ( ((RFILE *)fp)->eof & __SEOF ) #else #ifdef __Lynx__ if ( ((RFILE *)fp)->eof & _EOF ) #else if ( ((RFILE *)fp)->eof & _IOEOF ) #endif #endif #endif rc = 1 ; else rc = 0 ; END_TRACE() ; return rc ; } lcgdm-1.10.0/rfio/error.c0000644000175000017500000001246411436650662014473 0ustar ellertellert/* * $Id: error.c 3764 2010-08-30 06:37:38Z baud $ */ /* * Copyright (C) 1990-2010 by CERN-IT * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: error.c,v $ $Revision: 3764 $ $Date: 2010-08-30 08:37:38 +0200 (Mon, 30 Aug 2010) $ CERN/IT/PDP/DM Frederic Hemmer"; #endif /* not lint */ /* error.c Remote File I/O - error numbers and message handling */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include #include "rfio.h" #include #include /* * RFIO global error number. */ char *rfio_lasthost() ; char *rfio_serror() ; /* * Get remote error string corresponding to code. */ char DLL_DECL *rfio_errmsg_r (s, code, buf, buflen) int s; int code; char *buf; size_t buflen; { char *p; LONG len; char msg[CA_MAXLINELEN+1]; char rfio_buf[CA_MAXLINELEN+1]; if( buf == NULL || buflen <=0 ) return NULL; memset(buf, '\0', buflen); INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_errmsg(%d, %d)",s,code) ; p= rfio_buf ; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_ERRMSG); marshall_LONG(p, code); TRACE(2,"rfio","rfio_errmsg: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(s,rfio_buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio" ,"rfio_errmsg: write(): ERROR occured (errno=%d)", errno); END_TRACE(); return((char *) NULL); } TRACE(2, "rfio", "rfio_errmsg: reading %d bytes", LONGSIZE); if (netread_timeout(s,rfio_buf, LONGSIZE, RFIO_CTRL_TIMEOUT) != LONGSIZE) { TRACE(2, "rfio" ,"rfio_errmsg: read(): ERROR occured (errno=%d)", errno); END_TRACE(); return((char *) NULL); } p = rfio_buf ; unmarshall_LONG(p, len); TRACE(2, "rfio", "rfio_errmsg: reading %d bytes", len); if (netread_timeout(s,rfio_buf,len,RFIO_CTRL_TIMEOUT) != len) { TRACE(2, "rfio" ,"rfio_errmsg: read(): ERROR occured (errno=%d)", errno); END_TRACE(); return((char *) NULL); } p= rfio_buf; unmarshall_STRINGN(p, msg, CA_MAXLINELEN+1); TRACE(1, "rfio", "rfio_errmsg: <%s>", msg); END_TRACE(); strcpy(buf, msg); return(buf); } static int rfio_error_key = -1; char DLL_DECL *rfio_errmsg(s, code) int s; int code; { char *buf = NULL; int buflen = CA_MAXLINELEN+1; Cglobals_get(&rfio_error_key, (void **)&buf, buflen); return(rfio_errmsg_r(s, code, buf, buflen)); } char DLL_DECL *rfio_serror_r(buf, buflen) /* print an error message */ char *buf; size_t buflen; { int s; int last_rferr ; /* to preserve rfio_errno */ int last_err ; /* to preserve errno */ int last_serrno ; /* to preserve serrno */ int rt ; /* Request is from other network? */ char *rferrmsg ; char rerrlist[CA_MAXLINELEN+1] ; /* Message from errlist */ if( buf == NULL || buflen <=0 ) return NULL; memset(buf, '\0', buflen); INIT_TRACE("RFIO_TRACE"); last_err = errno ; last_rferr = rfio_errno ; last_serrno = serrno ; TRACE(2, "rfio", "rfio_serror: errno=%d, serrno=%d, rfio_errno=%d", errno, serrno, rfio_errno); END_TRACE(); if (last_serrno != 0) { return ( sstrerror(serrno) ); } else { if (last_rferr != 0) { if (last_rferr >= SEBASEOFF) return ( sstrerror(last_rferr) ); if ((s=rfio_connect(rfio_lasthost(),&rt)) == -1) { sprintf(rerrlist,"Unable to fetch remote error %d",last_rferr); rfio_errno = last_rferr ; strcpy(buf, rerrlist); return (buf); } else { if ( (rferrmsg = rfio_errmsg(s,last_rferr)) != NULL ) sprintf(rerrlist, "%s (error %d on %s)", rferrmsg, last_rferr, rfio_lasthost()); else sprintf(rerrlist, " (error %d on %s)", last_rferr, rfio_lasthost()); netclose(s); rfio_errno = last_rferr ; strcpy(buf, rerrlist); return (buf); } } else { if (serrno != 0) { strcpy( buf, sstrerror(serrno)); return (buf); } else { strcpy(buf, strerror(last_err)); return (buf); } } } } int DLL_DECL rfio_serrno() /* get error number - return -1 if cannot get it */ { int s; int last_rferr ; /* to preserve rfio_errno */ int last_err ; /* to preserve errno */ int last_serrno ; /* to preserve serrno */ int rt ; /* Request is from other network? */ INIT_TRACE("RFIO_TRACE"); last_err = errno ; last_rferr = rfio_errno ; last_serrno = serrno ; TRACE(2, "rfio", "rfio_serrno: errno=%d, serrno=%d, rfio_errno=%d", errno, serrno, rfio_errno); END_TRACE(); if (last_serrno != 0) { return (serrno); } else { if (last_rferr != 0) { rfio_errno = last_rferr ; return (rfio_errno); } else { if (serrno != 0) { return (serrno); } else { return (last_err); } } } } static int rfio_serror_key = -1; char DLL_DECL *rfio_serror() { char *buf = NULL; int buflen = CA_MAXLINELEN+1; Cglobals_get(&rfio_serror_key, (void **)&buf, buflen); return(rfio_serror_r(buf, buflen)); } void DLL_DECL rfio_perror(umsg) char *umsg ; { char *errmsg ; errmsg = rfio_serror(); if (errmsg != NULL ) fprintf(stderr,"%s : %s\n",umsg, errmsg); else fprintf(stderr,"%s : No error message\n",umsg); } lcgdm-1.10.0/rfio/rmdir.c0000644000175000017500000000575010222773541014451 0ustar ellertellert/* * $Id: rmdir.c,v 1.1 2005/03/31 13:13:04 baud Exp $ */ /* * Copyright (C) 1998-1999 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rmdir.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:04 $ CERN/IT/PDP/DM Olof Barring"; #endif /* not lint */ /* rmdir.c Remote File I/O - make a directory file */ #define RFIO_KERNEL 1 /* KERNEL part of the routines */ #include "rfio.h" /* Remote File I/O general definitions */ int DLL_DECL rfio_rmdir(dirpath) /* Remote rmdir */ char *dirpath; /* remote directory path */ { static char buf[BUFSIZ]; /* General input/output buffer */ register int s; /* socket descriptor */ int status; /* remote rmdir() status */ int len; char *host, *filename; char *p=buf; int rt ; int rcode, parserc ; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_rmdir(%s)", dirpath); if (!(parserc = rfio_parseln(dirpath,&host,&filename,NORDLINKS))) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file */ TRACE(1,"rfio","rfio_rmdir: %s is an HSM path", dirpath); END_TRACE(); rfio_errno = 0; return(rfio_HsmIf_rmdir(dirpath)); } TRACE(1, "rfio", "rfio_rmdir: using local rmdir(%s)", filename); END_TRACE(); rfio_errno = 0; return(rmdir(filename)); } if (parserc < 0) { END_TRACE(); return(-1); } s = rfio_connect(host,&rt); if (s < 0) { END_TRACE(); return(-1); } len = strlen(filename) + 1; if ( RQSTSIZE+len > BUFSIZ ) { TRACE(2,"rfio","rfio_rmdir: request too long %d (max %d)", RQSTSIZE+len,BUFSIZ); END_TRACE(); (void) netclose(s); serrno = E2BIG; return(-1); } marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_RMDIR); marshall_WORD(p, geteuid()); marshall_WORD(p, getegid()); marshall_LONG(p, len); p= buf + RQSTSIZE; marshall_STRING(p, filename); TRACE(2,"rfio","rfio_rmdir: sending %d bytes",RQSTSIZE+len) ; if (netwrite_timeout(s,buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { TRACE(2, "rfio", "rfio_rmdir: write(): ERROR occured (errno=%d)", errno); (void) close(s); END_TRACE(); return(-1); } p = buf; TRACE(2, "rfio", "rfio_rmdir: reading %d bytes", LONGSIZE); if (netread_timeout(s, buf, 2* LONGSIZE, RFIO_CTRL_TIMEOUT) != (2 * LONGSIZE)) { TRACE(2, "rfio", "rfio_rmdir: read(): ERROR occured (errno=%d)", errno); (void) close(s); END_TRACE(); return(-1); } unmarshall_LONG(p, status); unmarshall_LONG(p, rcode); TRACE(1, "rfio", "rfio_rmdir: return %d",status); rfio_errno = rcode; (void) close(s); if (status) { END_TRACE(); return(-1); } END_TRACE(); return (0); } lcgdm-1.10.0/rfio/rfio_rename.man0000644000175000017500000000545210222773541016152 0ustar ellertellert.\" .\" $Id: rfio_rename.man,v 1.1 2005/03/31 13:13:03 baud Exp $ .\" .\" @(#)$RCSfile: rfio_rename.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2001 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_RENAME 3 "$Date: 2005/03/31 13:13:03 $" CASTOR "Rfio Library Functions" .SH NAME rfio_rename \- rename a file or directory .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_rename (const char *" oldpath , .BI "const char *" newpath ) .SH DESCRIPTION .B rfio_rename renames a file or directory. .LP .I oldpath and .I newpath must be of the same type, i.e. both regular files or both directories. .LP If .I newpath exists already, it will be removed before the rename takes place. If .I newpath is a directory, it must be empty. .LP When renaming a directory, .I newpath must not be a descendant of .IR oldpath , i.e. .I newpath must not contain a path prefix that names .IR oldpath . .LP Write permission is required on both parents. If .I oldpath is a directory, write permission is required on it and if .I newpath is an existing directory, write permission is also required on it. .LP If any of the parents has the sticky bit S_ISVTX set, either .RS .LP the effective user ID of the requestor must match the owner ID of the file or .LP the effective user ID of the requestor must match the owner ID of the directory or .LP the file must be writable by the requestor or .LP the requestor must be super-user. .RE .SH RETURN VALUE This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B ENOENT A component of .I oldpath prefix does not exist or .I oldpath or .I newpath is a null pathname. .TP .B EACCES Search permission is denied on a component of the path prefixes or write permission on the parent directories is denied or .I oldpath is a directory and write permission is denied on .I oldpath or .IR newpath . .TP .B EFAULT .I oldpath or .I newpath is a NULL pointer. .TP .B EEXIST .I newpath is an existing directory and is not empty. .TP .B ENOTDIR A component of the path prefixes is not a directory or .I oldpath is a directory and .I newpath is an existing regular file. .TP .B EISDIR .I newpath is a directory while .I oldpath is a regular file. .TP .B EINVAL .I newpath is a descendant of .IR oldpath . .TP .B ENAMETOOLONG The length of .I oldpath or .I newpath exceeds .B CA_MAXPATHLEN or the length of a path component exceeds .BR CA_MAXNAMELEN . .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SECOMERR Communication error. .TP .B ERFXHOST Cross-host rename is not supported. .SH SEE ALSO .BR Castor_limits(4) , .BR rfio_chmod(3) , .BR rfio_unlink(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_fseek.man0000644000175000017500000000376610222773541016006 0ustar ellertellert.\" .\" $Id: rfio_fseek.man,v 1.1 2005/03/31 13:13:02 baud Exp $ .\" .\" @(#)$RCSfile: rfio_fseek.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:02 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2002 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_FSEEK 3 "$Date: 2005/03/31 13:13:02 $" CASTOR "Rfio Library Functions" .SH NAME rfio_fseek \- positions/repositions a file .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_fseek (FILE *" fp ", long " offset ", int " whence ");" .sp Under Linux, for large files: .br .B #define _LARGEFILE64_SOURCE .br .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_fseeko64 (FILE *" fp ", off64_t " offset ", int " whence ");" .br .sp For large files, under other systems: .br .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_fseeko64 (FILE *" fp ", off64_t " offset ", int " whence ");" .SH DESCRIPTION .B rfio_fseek positions/repositions to .I offset the file associated with the descriptor .I fp generated by a previous .BR rfio_fopen . .I whence indicates how to interpret the .I offset value: .RS .TP 1.3i .B SEEK_SET The offset is set from beginning of file. .TP .B SEEK_CUR The offset is added to current position. .TP .B SEEK_END The offset is added to current file size. .RE .B rfio_fseeko64 can be used with large files and allows to use a 64 bit offset rather than a long. .SH RETURN VALUE This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EBADF .I fp is not a valid descriptor. .TP .B EINVAL incorrect value for .IR whence . .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SETIMEDOUT Timed out. .TP .B SEBADVERSION Version ID mismatch. .TP .B SEINTERNAL Internal error. .TP .B SECONNDROP Connection closed by remote end. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR rfio_fopen(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/checkkey.c0000644000175000017500000001222212245612447015116 0ustar ellertellert/* * $Id: checkkey.c 9750 2013-11-28 10:04:23Z dhsmith $ */ /* * Copyright (C) 1993-2010 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: checkkey.c,v $ $Revision: 9750 $ $Date: 2013-11-28 11:04:23 +0100 (Thu, 28 Nov 2013) $ CERN/IT/PDP/DM Felix Hassine"; #endif /* not lint */ #include #include #include #if defined(_WIN32) #include #else #include #include #include #include #endif #include #include #include #include #include #include #include #define RFIO2TPREAD_MAGIC 0X0110 #define OK 1 extern int (*recvfunc)(); /* Network receive function */ extern int (*sendfunc)(); /* Network send function */ extern int DLL_DECL isremote_sa _PROTO((struct sockaddr *, char *)); #define netread (*recvfunc) #define netwrite (*sendfunc) #ifndef RFIO_CTRL_TIMEOUT #define RFIO_CTRL_TIMEOUT 10 #endif int connecttpread(host,aport) char * host ; u_short aport ; { struct sockaddr_storage sin ; /* An Internet socket address. */ int sock ; /* Socket descriptor. */ extern char * getenv() ; /* Getting env variables */ char * env ; /* To store env variables */ struct addrinfo hints, *ai, *aitop ; /* input/output from getaddrinfo*/ int gaierrno ; /* return code from lookups */ char strport[NI_MAXSERV] ; /* service name or port number */ log(LOG_DEBUG,"Connecting tpread@%s to check key on port %d\n",host,aport); memset (&hints, '\0', sizeof(struct addrinfo)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; #ifdef AI_ADDRCONFIG hints.ai_flags |= AI_ADDRCONFIG; #endif /* * Building Daemon Internet address. */ if ( (env=getenv("RFIO2TPREAD")) == NULL ) snprintf(strport, sizeof(strport), "%u", aport); else { snprintf(strport, sizeof(strport), "%s", env); } gaierrno = Cgetaddrinfo(host, strport, &hints, &aitop); if (gaierrno != 0) { serrno = SENOSHOST; log(LOG_ERR,"Cgetaddrinfo(): returned %d, errno %d\n",gaierrno,errno); return -1; } sock = -1; errno = 0; for(ai=aitop; ai; ai=ai->ai_next) { /* * Creating socket. */ if (( sock= socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol)) == -1 ) { continue; } /* * Connecting the socket. */ if ( connect(sock, ai->ai_addr, ai->ai_addrlen) == -1 ) { (void) close(sock); sock = -1; continue; } else { memcpy(&sin, ai->ai_addr, ai->ai_addrlen); break; } } freeaddrinfo(aitop); if (sock<0) { if (errno) log(LOG_ERR,"Could not connect to %s: Last error during socket() or connect(): %s\n", host,sstrerror(errno)); else log(LOG_ERR,"Could not connect to %s\n",host); return -1; } log(LOG_DEBUG,"Checking that key replier is in site\n"); if ( isremote_sa((struct sockaddr *)&sin, host) ) { log(LOG_INFO,"Attempt to give key from outside site rejected\n"); return -1 ; } if ( setnetio(sock) == -1 ) { log(LOG_ERR,"error in setnetio()\n") ; (void) close(sock) ; return -1 ; } return sock ; } /* * Returns 1 if key is valid, 0 otherwise. * returns -1 if failure */ int checkkey( sock, key ) int sock; u_short key; { int rcode ; int magic ; int answer; char marsh_buf[64] ; char *ptr; ptr = marsh_buf ; marshall_LONG(ptr,RFIO2TPREAD_MAGIC); marshall_LONG(ptr,(LONG)key); marshall_LONG(ptr, 0); /* * Sending key. */ if ( netwrite_timeout(sock,marsh_buf,3*LONGSIZE,RFIO_CTRL_TIMEOUT) != (3*LONGSIZE) ) { log(LOG_ERR,"netwrite(): %s\n", strerror(errno)) ; return -1 ; } /* * Waiting for ok akn. */ if ( (rcode= netread_timeout(sock,marsh_buf,LONGSIZE*3,RFIO_CTRL_TIMEOUT)) != (LONGSIZE*3) ) { log(LOG_ERR,"netread(): %s\n",strerror(errno)) ; (void) close(sock) ; return -1 ; } ptr = marsh_buf ; if ( rcode == 0 ) { log(LOG_ERR,"connection closed by remote end\n") ; (void) close(sock) ; return -1 ; } unmarshall_LONG(ptr,magic); if ( magic != RFIO2TPREAD_MAGIC ) { log(LOG_ERR,"Magic inconsistency. \n"); return -1 ; } unmarshall_LONG(ptr,answer); if ( answer==OK ) { log(LOG_DEBUG,"Key is correct.\n"); return 1 ; } else return 0 ; } lcgdm-1.10.0/rfio/getcwd.c0000644000175000017500000000217610222773541014610 0ustar ellertellert/* * $Id: getcwd.c,v 1.1 2005/03/31 13:13:00 baud Exp $ */ /* * Copyright (C) 2001-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: getcwd.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:00 $ CERN/IT/PDP/DM Jean-Philippe Baud"; #endif /* not lint */ #if defined(_WIN32) #include #endif /* getcwd.c Remote File I/O - get current working directory */ #define RFIO_KERNEL 1 /* KERNEL part of the routines */ #include "rfio.h" /* Remote File I/O general definitions */ char DLL_DECL *rfio_getcwd(char *buf, int size) { char *p; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_getcwd()"); if ( rfio_HsmIf_GetCwdType() > 0 ) { /* * HSM file */ TRACE(1, "rfio", "rfio_getcwd: current working directory is an HSM path"); END_TRACE(); rfio_errno = 0; return(rfio_HsmIf_getcwd(buf, size)); } TRACE(1, "rfio", "rfio_getcwd: using local getcwd()"); END_TRACE(); rfio_errno = 0; p = getcwd(buf, size); if ( ! p ) serrno = 0; return(p); } lcgdm-1.10.0/rfio/rfio_lockf.man0000644000175000017500000000410310222773541015771 0ustar ellertellert.\" .\" $Id: rfio_lockf.man,v 1.1 2005/03/31 13:13:03 baud Exp $ .\" .\" @(#)$RCSfile: rfio_lockf.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2002 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_LOCKF 3 "$Date: 2005/03/31 13:13:03 $" CASTOR "Rfio Library Functions" .SH NAME rfio_lockf \- provide record locking on files .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_lockf (int " sd ", int " op ", long " siz ");" .sp Under Linux, for large files: .br .B #define _LARGEFILE64_SOURCE .br .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_lockf64 (int " sd ", int " op ", off64_t " siz ");" .br .sp For large files, under other systems: .br .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_lockf64 (int " sd ", int " op ", off64_t " siz ");" .SH DESCRIPTION .B rfio_lockf restricts access to regions of files to the calling process. .LP .I sd is the file descriptor returned by a previous .BR rfio_open . .LP .I op specifies the action to be taken: .RS .TP 1.3i .B F_ULOCK unlock a region. .TP .B F_LOCK lock a region. .TP .B F_TLOCK test and lock a region. .TP .B F_TEST test a region for other locks. .RE .LP .I siz gives the size of the region to be locked, starting at the current file offset. .sp .B rfio_lockf64 must be used for large files and uses an off64_t instead of a long to specify the size of the region to be locked. .SH RETURN VALUE This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EBADF .I sd is not a valid descriptor. .TP .B EACCES The file region is locked and F_TEST or F_TLOCK was specified. .TP .B EINVAL incorrect value for .I op or .IR siz . .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SETIMEDOUT Timed out. .TP .B SECONNDROP Connection closed by remote end. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR rfio_open(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_stat64.man0000644000175000017500000000021210222773541016015 0ustar ellertellert.so ./rfio_stat.man .\" @(#)$RCSfile: rfio_stat64.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud lcgdm-1.10.0/rfio/unlink.c0000644000175000017500000000741310222773541014632 0ustar ellertellert/* * $Id: unlink.c,v 1.1 2005/03/31 13:13:04 baud Exp $ */ /* * Copyright (C) 1990-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: unlink.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:04 $ CERN/IT/PDP/DM Jean-Damien Durand"; #endif /* not lint */ #define RFIO_KERNEL 1 #include "rfio.h" #include #include #include #include /* malloc prototype */ /* * returns -1 if an error occured or no information is available at the * daemon's host. 0 otherwise. */ int DLL_DECL rfio_unlink(n2 ) char *n2 ; { int c; int status ; char *nbuf ; int s ; char *host ; char * filename; char *p ; int ans_req ,rt, parserc ; int rcode ; int uid ; int gid ; struct passwd *pw ; char buf[BUFSIZ]; char *n1 = ""; /* * The file is local. */ INIT_TRACE("RFIO_TRACE"); TRACE( 1, "rfio", " rfio_unlink (%s)",n2 ); if ( ! (parserc = rfio_parseln(n2,&host,&filename,NORDLINKS)) ) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file. */ TRACE(1,"rfio","rfio_unlink: %s is an HSM path", filename); END_TRACE(); rfio_errno = 0; status = rfio_HsmIf_unlink(filename); return(status); } TRACE(2,"rfio","rfio_unlink local %s",filename); status = unlink(filename) ; if ( status < 0 ) serrno = 0; END_TRACE() ; rfio_errno = 0; return(status) ; } if (parserc < 0) { END_TRACE(); return(-1); } s = rfio_connect(host,&rt); if (s < 0) { END_TRACE(); return(-1); } uid = geteuid() ; gid = getegid () ; if ( (pw = Cgetpwuid(uid) ) == NULL ) { TRACE(2, "rfio" ,"rfio_unlink: Cgetpwuid() error %s", strerror(errno)); END_TRACE(); return -1 ; } p = buf ; marshall_WORD(p, B_RFIO_MAGIC); marshall_WORD(p, RQST_SYMLINK); status = strlen(pw->pw_name)+strlen(n1)+strlen(filename)+3+2*WORDSIZE; marshall_LONG(p, status) ; if (netwrite_timeout(s,buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio", "unlink: write(): ERROR occured (errno=%d)", errno); (void) close(s); END_TRACE(); return(-1); } nbuf = (char *) malloc( status ) ; if ( nbuf == NULL ) { TRACE(2, "rfio", "unlink: malloc () failed"); (void) close(s); END_TRACE(); return(-1); } p = nbuf ; marshall_WORD(p,uid) ; marshall_WORD(p,gid) ; marshall_STRING( p, n1 ) ; marshall_STRING( p, filename ) ; marshall_STRING( p, pw->pw_name) ; if (netwrite_timeout(s,nbuf,status,RFIO_CTRL_TIMEOUT) != status ) { TRACE(2, "rfio", "unlink: write(): ERROR occured (errno=%d)",errno); (void) close(s); free(nbuf); END_TRACE(); return(-1); } (void) free(nbuf) ; /* * Getting back status */ if ((c=netread_timeout(s, buf, WORDSIZE + 2*LONGSIZE, RFIO_CTRL_TIMEOUT)) != (WORDSIZE+ 2*LONGSIZE)) { TRACE(2, "rfio", "rfio_unlink: read(): ERROR occured (errno=%d)", errno); (void) close(s); END_TRACE(); return(-1); } p = buf; unmarshall_WORD( p, ans_req ); unmarshall_LONG( p, status ) ; unmarshall_LONG( p, rcode ) ; if ( ans_req != RQST_SYMLINK ) { TRACE(1,"rfio","rfio_unlink: ERROR: answer does not correspond to request !"); (void) close(s); END_TRACE(); return(-1); } if ( status < 0 ) { TRACE(1,"rfio","rfio_unlink: failure, error %d",rcode); rfio_errno = rcode ; (void) close(s); END_TRACE(); return(status); } TRACE (2,"rfio","rfio_unlink succeded"); END_TRACE(); (void) close (s) ; return(status) ; } lcgdm-1.10.0/rfio/opendir.c0000644000175000017500000002267210741353420014772 0ustar ellertellert/* * $Id: opendir.c,v 1.2 2008/01/10 08:27:59 dhsmith Exp $ */ /* * Copyright (C) 1990-2003 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: opendir.c,v $ $Revision: 1.2 $ $Date: 2008/01/10 08:27:59 $ CERN/IT/PDP/DM Olof Barring"; #endif /* not lint */ /* opendir.c Remote File I/O - open a directory */ #define RFIO_KERNEL 1 /* system part of Remote File I/O */ #include /* system logger */ #include #include #include #include #include "rfio.h" /* remote file I/O definitions */ #include "rfio_rdirfdt.h" #include "rfcntl.h" /* remote file control mapping macros */ #if !defined(_WIN32) #include /* for inet_ntoa() */ #endif /* _WIN32 */ #include #include extern char *getacct(); static int na_key = -1; RDIR *rdirfdt[MAXRFD]; /* File descriptors tables */ /* * Forward declaration */ RDIR *rfio_opendir_ext(); static void rfio_dirsetup_ext(iop,uid,gid,passwd) RDIR *iop; int uid; int gid; int passwd; { iop->magic = RFIO_MAGIC; iop->s = -1; if (uid || gid) iop->mapping = 0; else iop->mapping = 1; iop->passwd = passwd; /* used only if mapping == 0 */ iop->uid = (uid==0 ? geteuid() : uid); iop->gid = (gid==0 ? getegid() : gid); INIT_TRACE("RFIO_TRACE"); TRACE ( 1,"rfio","rfio_dirsetup_ext(%d,%d,%d)",iop,uid,gid); TRACE ( 2,"rfio","rfio_dirsetup_ext: owner s uid is %d",iop->uid); TRACE ( 2,"rfio","rfio_dirsetup_ext: owner s gid is %d",iop->gid); END_TRACE(); iop->offset = 0; strcpy(iop->host,"????????"); } int rfio_dircleanup(s) /* cleanup rfio dir. descriptor */ int s; { int s_index; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_dircleanup(%d)", s); if ((s_index = rfio_rdirfdt_findentry(s,FINDRDIR_WITHOUT_SCAN)) != -1) { if (rdirfdt[s_index] != NULL) { if (rdirfdt[s_index]->magic != RFIO_MAGIC && rdirfdt[s_index]->magic != B_RFIO_MAGIC) { serrno = SEBADVERSION ; END_TRACE(); return(-1); } TRACE(2, "rfio", "freeing RFIO directory descriptor at 0X%X", rdirfdt[s_index]); (void) free((char *)rdirfdt[s_index]->dp.dd_buf); rfio_rdirfdt_freeentry(s_index); TRACE(2, "rfio", "closing %d",s) ; (void) close(s) ; } } END_TRACE(); return(0); } RDIR DLL_DECL *rfio_opendir(dirpath) char *dirpath; { char rh[1]; rh[0] = '\0'; return(rfio_opendir_ext(dirpath,(uid_t)0,(gid_t)0,0,rh,rh)); } RDIR DLL_DECL *rfio_opendir_ext(dirpath,uid,gid,passwd,reqhost,vmstr) char *dirpath; uid_t uid; gid_t gid; int passwd; char * reqhost; /* In case of a Non-mapped I/O with uid & gid sepcified, which host will be contacted for key check ? */ char *vmstr ; { int status ; /* Return code */ int rcode ; /* Remote errno */ int len ; char * host ; char * account; char *dirname ; char * p ; /* Pointer to rfio buffer */ RDIR *rdp ; /* Remote directory pointer */ int rdp_index; RDIR * dp ; /* Local directory pointer */ WORD req ; struct passwd *pw; int rt, parserc ; /* daemon in site(0) or not (1) */ extern void rfio_dirsetup_ext(); char rfio_buf[BUFSIZ] ; const char *tname, *tip; INIT_TRACE("RFIO_TRACE"); TRACE(1,"rfio","rfio_opendir(%s)",dirpath); /* * The directory is local. */ host = NULL; if ( ! (parserc = rfio_parse(dirpath,&host,&dirname)) ) { /* if not a remote file, must be local or HSM */ TRACE(2,"rfio","rfio_opendir(%s) rfio_parse returns host=%s", dirpath,(host != NULL ? host : "(nil)")); if ( host != NULL ) { /* * HSM file */ rfio_errno = 0; dp = (RDIR *)rfio_HsmIf_opendir(dirname); } else { #if defined(_WIN32) dp = NULL; serrno = SEOPNOTSUP; #else /* _WIN32 */ dp = (RDIR *)opendir(dirname); if ( ! dp ) serrno = 0; #endif /* _WIN32 */ } END_TRACE() ; return(dp); } if (parserc < 0) { END_TRACE(); return(NULL); } /* * Allocate and initialize a remote directory descriptor. */ if ((rdp = (RDIR *)malloc(sizeof(RDIR))) == NULL) { TRACE(2, "rfio", "rfio_opendir: malloc(): ERROR occured (errno=%d)", errno); END_TRACE(); return(NULL); } (void) memset(rdp,'\0',sizeof(RDIR)); rfio_dirsetup_ext(rdp,(int)uid,(int)gid,passwd) ; rdp->s = rfio_connect(host,&rt); if (rdp->s < 0) { TRACE(2, "rfio", "freeing RFIO descriptor at 0X%X", rdp); (void) free(rdp); END_TRACE(); return(NULL); } tname = Cgetnetaddress(rdp->s, NULL, 0, &na_key, &tip, NULL, 0, 0); if (tname == NULL || strlen(tip)>=RESHOSTNAMELEN) { TRACE(2, "rfio", "opendir: Cgetnetaddress: %s\n",(tname == NULL) ? sstrerror(serrno) : "Names too long"); close(rdp->s); (void) free(rdp); END_TRACE(); return(NULL); } if (strlen(tname)host, tname); else strcpy(rdp->host, tip); if ( !rt && !rdp->mapping ) { rdp->uid=geteuid() ; rdp->gid=getegid() ; TRACE(3,"rfio", "re-setting (uid,gid) to %d,%d",rdp->uid,rdp->gid) ; rdp->mapping = 1 ; } /* * Remote file table is not large enough. */ if ((rdp_index = rfio_rdirfdt_allocentry(rdp->s)) == -1) { TRACE(2, "rfio", "freeing RFIO descriptor at 0X%X", rdp); (void) free(rdp); END_TRACE(); errno= EMFILE ; return(NULL) ; } rdirfdt[rdp_index]=rdp; /* * Reserve space for the dirent buffer associated with this directory stream */ if ( (p = (char *)malloc(sizeof(struct dirent)+MAXFILENAMSIZE)) == NULL ) { TRACE(2, "rfio", "rfio_opendir: malloc(): ERROR occured (errno=%d)", errno); END_TRACE(); (void) free(rdp); return(NULL); } rdp->dp.dd_buf = p; rdp->dp.dd_size = sizeof(struct dirent)+MAXFILENAMSIZE; TRACE(2, "rfio", "rfio_opendir: setsockopt(SOL_SOCKET, SO_KEEPALIVE)"); rcode = 1 ; if (setsockopt(rdp->s, SOL_SOCKET, SO_KEEPALIVE,(char *)&rcode, sizeof (int) ) == -1) { TRACE(2, "rfio" ,"rfio_opendir: setsockopt(SO_KEEPALIVE) failed"); syslog(LOG_ALERT, "rfio: opendir: setsockopt(SO_KEEPALIVE): %s", strerror(errno)); } if ( (pw = Cgetpwuid(geteuid()) ) == NULL ) { TRACE(2, "rfio" ,"rfio_opendir: Cgetpwuid() error %s",strerror(errno)); rfio_dircleanup(rdp->s); END_TRACE(); return(NULL) ; } /* * Building and sending request. */ /* if ((account = getacct()) == NULL) */ account = ""; TRACE(2,"rfio","rfio_opendir: uid %d gid %d", rdp->uid,rdp->gid) ; TRACE(2,"rfio","rfio_opendir: account: %s",account) ; TRACE(2,"rfio","rfio_opendir: dirname: %s",dirname) ; if (reqhost != NULL && strlen(reqhost) ) TRACE(2,"rfio","rfio_opendir: requestor's host: %s",reqhost) ; p= rfio_buf ; len= 3*WORDSIZE + LONGSIZE + strlen(account) + strlen(dirname) +strlen(pw->pw_name) + strlen(reqhost) + strlen(vmstr) + 5 ; marshall_WORD(p,RFIO_MAGIC) ; marshall_WORD(p,RQST_OPENDIR) ; marshall_LONG(p,len) ; p= rfio_buf + RQSTSIZE ; marshall_WORD(p,rdp->uid) ; marshall_WORD(p,rdp->gid) ; marshall_STRING(p,account) ; marshall_STRING(p,dirname) ; marshall_STRING(p,pw->pw_name) ; marshall_STRING(p,reqhost) ; marshall_LONG(p,rdp->passwd); marshall_WORD(p,rdp->mapping); marshall_STRING(p, vmstr) ; TRACE(2,"rfio","rfio_opendir: sending %d bytes",RQSTSIZE+len) ; if (netwrite_timeout(rdp->s,rfio_buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { TRACE(2,"rfio","rfio_opendir: write(): ERROR occured (errno=%d)", errno) ; syslog(LOG_ALERT, "rfio: opendir: %s (error %d with %s) [uid=%d,gid=%d,pid=%d] in netwrite(%d,0X%lX,%d)", strerror(errno), errno, rdp->host, rdp->uid, rdp->gid, getpid(), rdp->s, (unsigned long) rfio_buf, RQSTSIZE+len); rfio_dircleanup(rdp->s) ; END_TRACE() ; return(NULL) ; } /* * Getting status. */ TRACE(1, "rfio", "rfio_opendir: reading %d bytes",WORDSIZE+3*LONGSIZE) ; if (netread_timeout(rdp->s,rfio_buf,WORDSIZE+3*LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+3*LONGSIZE) ) { TRACE(2, "rfio", "rfio_opendir: read(): ERROR occured (errno=%d)", errno); syslog(LOG_ALERT, "rfio: opendir: %s (error %d with %s) [uid=%d,gid=%d,pid=%d] in netread(%d,0X%lX,%d)", strerror(errno), errno, rdp->host, rdp->uid, rdp->gid, getpid(), rdp->s, (unsigned long) rfio_buf, WORDSIZE+3*LONGSIZE); rfio_dircleanup(rdp->s); END_TRACE(); return(NULL); } p= rfio_buf ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; TRACE(1,"rfio","rfio_opendir: return status(%d), rcode(%d), fd: %d",status,rcode,rdp->s) ; if ( status < 0 ) { if ( rcode >= SEBASEOFF) serrno = rcode ; else rfio_errno= rcode ; /* Operation failed but no error message was sent */ if ( rcode == 0 ) serrno = SENORCODE ; rfio_dircleanup(rdp->s) ; END_TRACE() ; return(NULL); } /* * The directory is open, update rdp->dp */ rdp->dp.dd_fd = rdp->s; /* * Logical (dirent) offset in directory */ rdp->dp.dd_loc = 0; END_TRACE() ; return(rdp); } lcgdm-1.10.0/rfio/fseek.c0000644000175000017500000000360511533400617014423 0ustar ellertellert/* * $Id: fseek.c 4148 2011-03-02 08:36:31Z baud $ */ /* * Copyright (C) 1998-2011 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: fseek.c,v $ $Revision: 4148 $ $Date: 2011-03-02 09:36:31 +0100 (Wed, 02 Mar 2011) $ CERN/IT/PDP/DM Fabien Collin"; #endif /* not lint */ /* fseek.c Remote File I/O - fseek library call */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rfilefdt.h" #include /* * Remote file fseek */ int DLL_DECL rfio_fseek(fp, offset, whence) RFILE *fp; long int offset; int whence; { int rc; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_fseek(%x, %d, %d)", fp, offset, whence); /* * Checking fp validity */ if (fp == NULL) { errno = EBADF; TRACE(2,"rfio","rfio_fseek() : FILE ptr is NULL "); END_TRACE(); return -1; } if (rfio_rfilefdt_findptr(fp,FINDRFILE_WITH_SCAN) == -1) { TRACE(2,"rfio","rfio_fseek() : using local fseek() "); rc = fseek((FILE *)fp, offset, whence); if ( rc < 0 ) serrno = 0; rfio_errno = 0; END_TRACE(); return rc; } TRACE(2,"rfio","rfio_fseek() : after remoteio") ; /* * Checking magic number */ if (fp->magic != RFIO_MAGIC) { int fps = fp->s; serrno = SEBADVERSION; TRACE(2,"rfio","rfio_fseek() : Bad magic number"); free((char *)fp); (void) close(fps); END_TRACE(); return -1; } /* * The file is remote */ rc = rfio_lseek(fp->s,offset,whence); switch(rc) { case -1: #ifdef linux ((RFILE *)fp)->eof |= _IO_ERR_SEEN; #else #if defined( __APPLE__) ((RFILE *)fp)->eof |= __SERR; #else #ifdef __Lynx__ ((RFILE *)fp)->eof |= _ERR; #else ((RFILE *)fp)->eof |= _IOERR; #endif #endif #endif break; default: rc = 0; break; } END_TRACE(); return rc; } lcgdm-1.10.0/rfio/rfiosetopt.man0000644000175000017500000000704111336206564016061 0ustar ellertellert.\" @(#)$RCSfile: rfiosetopt.man,v $ $Revision: 3174 $ $Date: 2010-02-15 10:01:40 +0100 (Mon, 15 Feb 2010) $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2010 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIOSETOPT 3 "$Date: 2010-02-15 10:01:40 +0100 (Mon, 15 Feb 2010) $" CASTOR "Rfio Library Functions" .SH NAME rfiosetopt \- set RFIO options .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfiosetopt (int " opt , .BI "int *" pval , .BI "int " len ) .sp .BI "int rfio_setbufsize (int " s , .BI "int " bufsize ) .SH DESCRIPTION .B rfiosetopt sets the RFIO option .I opt to the content of the memory cell pointed by .IR pval . .LP .B rfio_setbufsize sets the size of the readahead buffer to be used on a particular socket connection. .LP .I opt can have on of the following values: .RS .TP .B RFIO_READOPT The value pointed by pval can be 0, RFIO_READBUF, RFIO_READAHEAD or RFIO_STREAM (V3). .RS .TP If set to zero, a normal read will be used (one request to the server per read). .LP If set to RFIO_READBUF, an internal buffer is allocated in the client API, each call to the server fills this buffer and the user buffer is filled from the internal buffer. There is one server call per buffer fill. .LP If set to RFIO_READAHEAD, an initial call is sent to the server which pushes data to the client buffer until end of file is reached or an error occurs or a new request comes from the client. There is no intermediate buffer unless RFIO_READBUF|RFIO_READAHEAD is specified. .LP If RFIO_STREAM is set, the V3 protocol is enabled. This uses 2 socket connections between the client and the server and the server itself is multi-threaded allowing overlap of disk and network operations. The data is pushed on the data socket until end of file is reached or an error occurs. The transfer can be interrupted by sending a packet on the control socket. .br Default is RFIO_READBUF. .LP The default internal buffer size is 128kB, but the buffer size can be set with an entry RFIO IOBUFSIZE in .B shift.conf or thru the environment variable RFIO_IOBUFSIZE. .RE .TP .B RFIO_NETOPT The value pointed by pval can be RFIO_NONET or RFIO_NET. If set to RFIO_NONET, the NET entries in .B shift.conf are ignored. Default is RFIO_NET. .TP .B RFIO_NETRETRYOPT The value pointed by pval can be RFIO_RETRYIT or RFIO_NOTIME2RETRY. .RS .LP If set to RFIO_RETRYIT, there will be retries on failing connect. The number of retries is given by the environment variable RFIO_CONRETRY or the RFIO CONRETRY entry in .BR shift.conf . The retry interval (in seconds) is given by the environment variable RFIO_CONRETRYINT or the RFIO CONRETRYINT entry. .LP If set to RFIO_NOTIME2RETRY, there will be no retry on failing connect. .br Default is RFIO_RETRYIT. .RE .TP .B RFIO_CONNECTOPT The value pointed by pval can be RFIO_NOLOCAL or RFIO_FORCELOCAL. If set to RFIO_FORCELOCAL, no parsing is done on pathname. The file is assumed to be local. Default is RFIO_NOLOCAL. .RE .LP The .I len argument is ignored. .LP .I s is the file descriptor of the receiving socket. .LP .I bufsize is the size of the readahead buffer to be used. .SH RETURN VALUE .B rfiosetopt returns 0 if the operation was successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B ENOMEM buffer could not be allocated. .TP .B EINVAL .I opt is not a valid option, .I bufsize is negative or the user tries to change the buffer size after the actual I/O has started. .SH SEE ALSO .BR rfio_open(3) , .BR rfioreadopt(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_readdir.man0000644000175000017500000000353611356313176016321 0ustar ellertellert.\" .\" $Id: rfio_readdir.man 3515 2010-04-05 07:51:26Z baud $ .\" .\" @(#)$RCSfile: rfio_readdir.man,v $ $Revision: 3515 $ $Date: 2010-04-05 09:51:26 +0200 (Mon, 05 Apr 2010) $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2010 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_READDIR 3 "$Date: 2010-04-05 09:51:26 +0200 (Mon, 05 Apr 2010) $" CASTOR "Rfio Library Functions" .SH NAME rfio_readdir \- read directory opened by .B rfio_opendir .SH SYNOPSIS .B #include .br .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "struct dirent *rfio_readdir (RDIR *" dirp ");" .SH DESCRIPTION .B rfio_readdir reads the directory opened by .BR rfio_opendir . This routine returns a pointer to a structure containing the current directory entry. .TP .I dirp specifies the pointer value returned by .BR rfio_opendir . .SH NOTES Only the fields d_name, d_reclen and on some platforms d_namlen are filled. For CASTOR directories, a multi-threaded application will need to initialize itself the Cthread (CASTOR Thread Interface) library ; this is done by including "shift/Cthread_api.h" and calling the function Cthread_init() at the beginning. Otherwise accessing CASTOR directories will not be thread-safe. See \fBCthread\fP(3). .SH RETURN VALUE This routine returns a pointer to a structure containing the current directory entry if the operation was successful or NULL if the end of the directory was reached or if the operation failed. In the latter case, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EBADF File descriptor in DIR structure is invalid. .TP .B EFAULT .I dirp is a NULL pointer. .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR rfio_closedir(3) , .BR rfio_opendir(3) , .BR rfio_rewinddir(3) , .B dirent .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_ferror.man0000644000175000017500000000215010222773541016172 0ustar ellertellert.\" .\" $Id: rfio_ferror.man,v 1.1 2005/03/31 13:13:02 baud Exp $ .\" .\" @(#)$RCSfile: rfio_ferror.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:02 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2001 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_FERROR 3 "$Date: 2005/03/31 13:13:02 $" CASTOR "Rfio Library Functions" .SH NAME rfio_ferror, rfio_eof \- checks file status .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_ferror (FILE *" fp ");" .br .BI "int rfio_feof (FILE *" fp ");" .SH DESCRIPTION .B rfio_ferror tests the error indicator for the file whose descriptor \fBfp\fP is the one returned by .B rfio_fopen. .LP .B rfio_feof tests the end-of-file indicator for the file whose descriptor \fBfp\fP is the one returned by .B rfio_fopen. .SH RETURN VALUE This routine returns >0 if set, 0 if not set, -1 if the operation failed and .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EBADF .I fp is not a valid file descriptor. .TP .B SEBADVERSION Version ID mismatch. .SH SEE ALSO .BR rfio_fopen(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/fwrite.c0000644000175000017500000000367411533400617014634 0ustar ellertellert/* * $Id: fwrite.c 4148 2011-03-02 08:36:31Z baud $ */ /* * Copyright (C) 1990-2011 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: fwrite.c,v $ $Revision: 4148 $ $Date: 2011-03-02 09:36:31 +0100 (Wed, 02 Mar 2011) $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy"; #endif /* not lint */ /* fwrite.c Remote File I/O - write a binary file */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rfilefdt.h" #include /* * Remote file buffered write */ int DLL_DECL rfio_fwrite(ptr, size, items, fp) void *ptr; /* buffer pointer */ int size, items; RFILE *fp; { int rc ; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_fwrite(%x, %d, %d, %x)", ptr, size, items, fp); if (fp == NULL ) { errno = EBADF ; END_TRACE() ; return 0 ; } if (rfio_rfilefdt_findptr(fp,FINDRFILE_WITH_SCAN) == -1) { rc= fwrite(ptr, size, items, (FILE *)fp) ; if ( rc == 0 ) serrno = 0; END_TRACE() ; rfio_errno = 0; return rc ; } /* * Checking magic number */ if ( fp->magic != RFIO_MAGIC) { int fps = fp->s; serrno = SEBADVERSION ; free((char *)fp); (void) close(fps) ; END_TRACE(); return 0 ; } /* * The file is remote */ rc= rfio_write(fp->s,ptr,size*items) ; switch(rc) { case -1: #ifdef linux ((RFILE *)fp)->eof |= _IO_ERR_SEEN ; #else #if defined( __APPLE__) ((RFILE *)fp)->eof |= __SERR ; #else #ifdef __Lynx__ ((RFILE *)fp)->eof |= _ERR ; #else ((RFILE *)fp)->eof |= _IOERR ; #endif #endif #endif rc= 0 ; break ; case 0: #ifdef linux ((RFILE *)fp)->eof |= _IO_EOF_SEEN ; #else #if defined( __APPLE__) ((RFILE *)fp)->eof |= __SEOF ; #else #ifdef __Lynx__ ((RFILE *)fp)->eof |= _EOF ; #else ((RFILE *)fp)->eof |= _IOEOF ; #endif #endif #endif break ; default: rc= (rc+size-1)/size ; break ; } END_TRACE() ; return rc ; } lcgdm-1.10.0/rfio/rfioreadopt.man0000644000175000017500000000166310222773541016202 0ustar ellertellert.\" @(#)$RCSfile: rfioreadopt.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:04 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2001 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIOREADOPT 3 "$Date: 2005/03/31 13:13:04 $" CASTOR "Rfio Library Functions" .SH NAME rfioreadopt \- get RFIO options .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfioreadopt (int " opt ) .SH DESCRIPTION .B rfioreadopt returns the option value. .TP .I opt can have on of the following values: .RS .TP 1.3i .B RFIO_READOPT .TP .B RFIO_NETOPT .TP .B RFIO_NETRETRYOPT .TP .B RFIO_CONNECTOPT .RE .SH RETURN VALUE .B rfioreadopt returns the option value when successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EINVAL .I opt is not a valid option. .SH SEE ALSO .BR rfiosetopt(3) , .BR rfio_open(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfrename.c0000644000175000017500000000270711336205452015130 0ustar ellertellert/* * $Id: rfrename.c 3172 2010-02-15 08:51:54Z baud $ */ /* * Copyright (C) 1998-2010 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rfrename.c,v $ $Revision: 3172 $ $Date: 2010-02-15 09:51:54 +0100 (Mon, 15 Feb 2010) $ CERN/IT/PDP/DM Olof Barring"; #endif /* not lint */ /* * Make remote directory */ #include #include #include #if defined(_WIN32) #include #endif /* _WIN32 */ #include static char *ckpath(); char *getconfent(); int main(argc, argv) int argc; char *argv[]; { char *old_path,*new_path; #if defined(_WIN32) WSADATA wsadata; #endif if ( argc < 3 ) { fprintf(stderr,"Usage: %s old-path new-path\n",argv[0]); exit(2); } old_path = ckpath(argv[1]); new_path = ckpath(argv[2]); #if defined(_WIN32) if (WSAStartup (MAKEWORD (2, 0), &wsadata)) { fprintf (stderr, "WSAStartup unsuccessful\n"); exit (2); } #endif if ( rfio_rename(old_path,new_path) ) { rfio_perror("rename()"); exit(1); } return(0); } static char *ckpath(path) char *path; { char *cp; char *newpath; newpath = (char *)malloc(BUFSIZ*sizeof(char)); /* Special treatment for filenames starting with /scratch/... */ if (!strncmp ("/scratch/", path, 9) && (cp = getconfent ("SHIFT", "SCRATCH", 0)) != NULL) { strcpy (newpath, cp); strcat (newpath, path+9); } else strcpy(newpath,path); return(newpath); } lcgdm-1.10.0/rfio/rfio_lstat.man0000644000175000017500000000021110222773541016016 0ustar ellertellert.so ./rfio_stat.man .\" @(#)$RCSfile: rfio_lstat.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud lcgdm-1.10.0/rfio/README.Win320000644000175000017500000000511310222773541014742 0ustar ellertellert RFIOD installation on Windows/NT 1) Run 'nmake -f Makefile.ini.Win32' from the directory where you have unpacked the SHIFT distribution file in order to compile the imake.exe program. 2) Run 'nmake Makefiles'. This command will generate all Makefiles in the subdirectories using the above-made imake. 3) Change your current directory to 'rfio' subdirectory. Run 'nmake'. Compilation and linking will take about 5-10 minutes. 4) Run 'nmake install' command (it is optional). As a result of this command, all rfio executables will be moved to the c:\Shift\bin directory. 5) To compile the installation program, type: cd ..\win32 cl install.c advapi32.lib As a result, the install.exe program should appear. 6) Installing rfiod service: install -i rfiod "RFIO Daemon" c:\Shift\bin\rfiod.exe The syntax on the install command is the following: install -i service_name service_label path -i - installation, service_name - name of the service used internally by the Service Control Manager, service_label - label used to display in the Services Applet of the Control Panel (may contain multiple words, but you have to put them in double quotes) path - _full_ path to the service executable. 7) Removing service: install -u service_name -u - removal, service_name - the same parameter which was used when installing service. 8) Configuration changes needed to run rfiod: - add the following entry to your %SystemRoot%\system32\drivers\etc\Services file: rfio 5001/tcp # Remote File Access - create a %SystemRoot%\system32\drivers\etc\shift.conf file - you may set various parameters in it (see shift.inst file for details). I recommend to set the following parameters in it: RFIO DAEMONV3_RDSIZE 262144 RFIO DAEMONV3_WRSIZE 262144 9) Starting rfiod: - go to the Control Panel - open the Services applet - find the RFIO Daemon entry among the services - enter the startup parameters in the Startup Parameters window - press the Start button - after successful start, rfiod runs like the regular Windows NT service, e.g, you may pause it, resume it, stop, start again... - all the error messages and communicates are directed to the Application Log (you can view them using the Event Viewer). 10) Miscellaneous. To recompile rfiod, you don't need to remove the service from the system. It is sufficient to stop it (using the Service applet from Control Panel), but the new executable must be put in the same place the old one was. lcgdm-1.10.0/rfio/fortran.F0000644000175000017500000001023110222773541014740 0ustar ellertellertc c $Id: fortran.F,v 1.1 2005/03/31 13:13:00 baud Exp $ c c $Log: fortran.F,v $ c Revision 1.1 2005/03/31 13:13:00 baud c imported from CASTOR c c Revision 1.2 1999/07/20 12:47:58 jdurand c 20-JUL-1999 Jean-Damien Durand c Timeouted version of RFIO. Using netread_timeout() and netwrite_timeout c on all control and data sockets. c c c Copyright (C) 1990,1991 by CERN/CN/SW/DC c All rights reserved c c fortran.F remote file I/O - C callable server fortran interface c c fopn_us(int *unit, char *file, int *filen, int *append, int *irc) c fopn_ud(int *unit, char *file, int *filen, int *lrecl, int *irc) c fwr_us(int *unit, char *buf, int *nwrit, int *irc) c fwr_ud(int *unit, char *buf, int *nrec, int *nwrit, int *irc) c frd_us(int *unit, char *buf, int *nwant, int *irc) c frd_ud(int *unit, char *buf, int *nrec, int *nwant, int *irc) c fcls_f(int *unit, int *irc); c frdc(int *unit, char *buf, int *nwant, int *ngot, int *irc) c c subroutine fopn_us(unit, file, filen, append, irc) c implicit none integer unit character*256 file integer filen integer append integer irc c character*80 SCCSID data SCCSID / + "@(#)fortran.F 3.5 09/24/92 CERN CN-SW/DC F. Hemmer"/ c c #if (defined(ultrix) && defined(mips)) c this helps getfilep in getting the fp.Apparently the binding which is c done by a fortran main program at runtime is not done when a subroutine c is called from a C program.This command forces it . AK 14/02/92 c It is a temporary solution till a better one is found. c write(*,*) c #endif c if (append .eq. 0) then open(unit=unit,file=file(1:filen),iostat=irc, + FORM='UNFORMATTED',ACCESS='SEQUENTIAL') else #if defined(sun) || defined(sgi) || defined(hpux) || ( defined(ultrix) && defined(mips) ) open(unit=unit,file=file(1:filen),iostat=irc, + FORM='UNFORMATTED',ACCESS='APPEND') #endif /* sun || sgi || hpux || ( ultrix && mips ) */ #if defined(apollo) open(unit=unit,file=file(1:filen),iostat=irc, + FORM='UNFORMATTED',ACCESS='SEQUENTIAL',STATUS='APPEND') #endif /* apollo */ #if defined(_AIX) open(unit=unit,file=file(1:filen),iostat=irc, + FORM='UNFORMATTED',ACCESS='SEQUENTIAL',STATUS='OLD') #if defined(_IBMESA) 1 read(unit=unit,end=2) go to 1 2 backspace unit #endif #endif /* AIX */ #if defined(CRAY) open(unit=unit,file=file(1:filen),iostat=irc,FORM='UNFORMATTED', + ACCESS='SEQUENTIAL', POSITION='APPEND') #endif /* CRAY */ endif end c subroutine fopn_ud(unit, file, filen, lrecl, irc) implicit none integer unit character*256 file integer filen integer lrecl integer irc c #if defined(sgi) lrecl=(lrecl+3)/4 #endif /* sgi */ open(unit=unit,file=file(1:filen),iostat=irc,FORM='UNFORMATTED', + ACCESS='DIRECT',RECL=lrecl) end c subroutine fcls_f(unit, irc) implicit none integer unit integer irc c close(unit=unit,iostat=irc) end c subroutine fwr_us(unit, buf, nwrit, irc) implicit none integer unit integer nwrit character*1 buf(nwrit) integer irc c write(unit,iostat=irc) buf end c subroutine fwr_ud(unit, buf, nrec, nwrit, irc) implicit none integer nwrit integer unit character*1 buf(nwrit) integer nrec integer irc c write(unit,rec=nrec,iostat=irc) buf end c subroutine frd_us(unit, buf, nwant, irc) implicit none integer unit integer nwant character*1 buf(nwant) integer irc c read(unit,iostat=irc) buf end c subroutine frd_ud(unit, buf, nrec, nwant, irc) implicit none integer unit integer nwant character*1 buf(nwant) integer nrec integer irc c read(unit,rec=nrec,iostat=irc) buf end c subroutine frdc(unit, buf, nwant, ngot, irc) implicit none integer unit integer nwant character*1 buf(nwant) integer ngot integer irc integer count #if defined(CRAY) integer ubc c count = (nwant+7)/8 call read(unit,buf,count,irc,ubc) ngot = count*8 - ubc/8 end #else c count = nwant call readf(unit,buf(1),count,irc) ngot = count end #endif /* CRAY */ lcgdm-1.10.0/rfio/rfio_ftell.man0000644000175000017500000000274410222773541016012 0ustar ellertellert.\" .\" $Id: rfio_ftell.man,v 1.1 2005/03/31 13:13:02 baud Exp $ .\" .\" @(#)$RCSfile: rfio_ftell.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:02 $ CERN IT-DS-HSM Benjamin Couturier .\" Copyright (C) 2002 by CERN/IT-DS-HSM .\" All rights reserved .\" .TH RFIO_FTELL 3 "$Date: 2005/03/31 13:13:02 $" CASTOR "Rfio Library Functions" .SH NAME rfio_ftell \- tells the position in a stream .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "long rfio_ftell (FILE *" fp ");" .sp Under Linux, for large files: .br .B #define _LARGEFILE64_SOURCE .br .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "off64_t rfio_ftello64 (FILE *" fp ");" .br .sp For large files, under other systems: .br .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "off64_t rfio_ftello64 (FILE *" fp ");" .SH DESCRIPTION .B rfio_ftell returns the current position in the file stream pointed by .IR fp . .SH RETURN VALUE This routine returns the position if the operation was successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EBADF .I fp is not a valid descriptor. .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SETIMEDOUT Timed out. .TP .B SEBADVERSION Version ID mismatch. .TP .B SEINTERNAL Internal error. .TP .B SECONNDROP Connection closed by remote end. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR rfio_fopen(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfstat.man0000644000175000017500000000310611576042362015164 0ustar ellertellert.\" .\" $Id: rfstat.man 4455 2011-06-15 05:36:50Z baud $ .\" .\" @(#)$RCSfile: rfstat.man $ $Revision: 4455 $ $Date: 2011-06-15 07:36:50 +0200 (Wed, 15 Jun 2011) $ CERN IT-GT Jean-Philippe Baud .\" Copyright (C) 1998-2011 by CERN/IT/GT .\" All rights reserved .\" .TH RFSTAT 1 "$Date: 2011-06-15 07:36:50 +0200 (Wed, 15 Jun 2011) $" CASTOR "Rfio User Commands" .SH NAME rfstat \- get information about a file or directory .SH SYNOPSIS .B rfstat .IR directory .br .B rfstat .IR filename .SH DESCRIPTION .IX "\fLrfstat\fR" The rfstat program provides an interface to the .B shift remote file I/O daemon (rfiod) for getting information about a remote directory or file. The .IR filename or .IR directory argument is either a remote file name of the form: .IP .IB hostname : path .LP or a local file name (not containing the :/ character combination). The output from the .BR rfstat command gives information similar to that of the .BR "ls -il" command for listing local files or directories, one field per line. .SH EXAMPLE .nf .ft CW rfstat /tmp Device : 802 Inode number : 2 Nb blocks : 16 Protection : drwxrwxrwt (41777) Hard Links : 13 Uid : 0 (root) Gid : 0 (root) Size (bytes) : 4096 Last access : Wed Jun 15 07:18:10 2011 Last modify : Wed Jun 15 07:18:10 2011 Last stat. mod. : Wed Jun 15 07:18:10 2011 .ft .fi .SH "SEE ALSO" .BR rfio_stat(3), .BR rfiod(1) .SH "NOTES" .B rfstat does not support regular expressions .BR (regexp(5)) in the .IR directory or .IR filename argument. .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_perror.man0000644000175000017500000000225710222773541016214 0ustar ellertellert.\" .\" $Id: rfio_perror.man,v 1.1 2005/03/31 13:13:03 baud Exp $ .\" .\" @(#)$RCSfile: rfio_perror.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2003 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_PERROR 3 "$Date: 2005/03/31 13:13:03 $" CASTOR "Rfio Library Functions" .SH NAME rfio_perror \- print error message corresponding to the last RFIO function failure .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "void rfio_perror (const char *" umsg ");" .sp .BI "int rfio_serrno ();" .sp .BI "char *rfio_serror ();" .SH DESCRIPTION .B rfio_serrno gets error code corresponding to the last RFIO function failure (local or remote). .B rfio_serror gets error message corresponding to the last RFIO function failure (local or remote). .B rfio_perror produces a message on standard error describing the last RFIO error. The message is prefixed with .I umsg followed by a colon and a blank. .SH RETURN VALUE .B rfio_serrno returns the last error code: .BR errno , .B serrno or .BR rfio_errno . .B rfio_serror returns a pointer to the error string. .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/chdir.c0000644000175000017500000000313310222773541014416 0ustar ellertellert/* * $Id: chdir.c,v 1.1 2005/03/31 13:12:59 baud Exp $ */ /* * Copyright (C) 2001-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: chdir.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:12:59 $ CERN/IT/PDP/DM Jean-Philippe Baud"; #endif /* not lint */ /* chdir.c Remote File I/O - change working directory */ #define RFIO_KERNEL 1 /* KERNEL part of the routines */ #include "rfio.h" /* Remote File I/O general definitions */ int DLL_DECL rfio_chdir(dirpath) char *dirpath; /* directory path */ { char *filename; char *host; int rc; int parserc; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_chdir(%s)", dirpath); if (!(parserc = rfio_parseln(dirpath, &host, &filename, NORDLINKS))) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file */ TRACE(1, "rfio", "rfio_chdir: %s is an HSM path", filename); END_TRACE(); rfio_errno = 0; if ( (rc = rfio_HsmIf_chdir(filename)) == 0 ) rfio_HsmIf_SetCwdServer(host); return(rc); } TRACE(1, "rfio", "rfio_chdir: using local chdir(%s)", filename); END_TRACE(); rfio_errno = 0; if ( (rc = chdir(filename)) == 0 ) rfio_HsmIf_SetCwdType(0); else serrno = 0; return(rc); } if (parserc < 0) { END_TRACE(); return(-1); } END_TRACE(); rfio_errno = 0; serrno = SEOPNOTSUP; return (-1); } lcgdm-1.10.0/rfio/rfio_serrno.man0000644000175000017500000000021410222773541016202 0ustar ellertellert.so ./rfio_perror.man .\" @(#)$RCSfile: rfio_serrno.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud lcgdm-1.10.0/rfio/xyopen.c0000644000175000017500000003017011336205452014646 0ustar ellertellert/* * $Id: xyopen.c 3172 2010-02-15 08:51:54Z baud $ */ /* * Copyright (C) 1990-2010 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: xyopen.c,v $ $Revision: 3172 $ $Date: 2010-02-15 09:51:54 +0100 (Mon, 15 Feb 2010) $ CERN/IT/PDP/DM Frederic Hemmer, F. Hassine"; #endif /* not lint */ /* xyopen.c Remote File I/O - Open a Fortran Logical Unit */ /* * C bindings : * * rfio_xyopen(char *filename, char *host, int lun, int lrecl, * char *chopt, int *irc) * * FORTRAN bindings : * * XYOPEN(INTEGER*4 LUN, INTEGER*4 LRECL, CHARACTER*(*) CHOPT, INTEGER*4 IRC) * XYOPN(CHARACTER*(*) FILENAME, CHARACTER*(*)HOST, INTEGER*4 LUN, * INTEGER*4 LRECL, CHARACTER*(*) CHOPT, INTEGER*4 IRC) */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #if defined(_WIN32) #define MAXHOSTNAMELEN 64 #else #include #endif #include #include #include #include #include RFILE DLL_DECL *ftnlun[MAXFTNLUN]; /* Fortran logical units */ extern char *getacct(); extern int DLL_DECL switch_open(); int DLL_DECL rfio_xysock(lun) int lun ; { if ( ftnlun[lun] == NULL ) return -1 ; else return ftnlun[lun]->s ; } int DLL_DECL rfio_xyopen(name,node,lun,lrecl,chopt,irc) char *name, *node, *chopt; int lun, lrecl; int *irc; { char rh[1]; rh[0]='\0'; return( rfio_xyopen_ext(name,node,lun,lrecl,chopt,irc,(uid_t)0,(gid_t)0,0,rh) ); } int rfio_xyopen_ext(name,node,lun,lrecl,chopt,irc,uid,gid,key,reqhost) char *name, *node, *chopt; int lun, lrecl; int *irc; uid_t uid; gid_t gid; int key; char *reqhost; { register int s; /* socket descriptor */ int status; /* remote fopen() status */ int len; /* total string length */ int i; /* general purpose index */ char * p ; /* buffer pointer */ WORD access, format; /* Fortran file characteristics */ LONG openopt; /* Fortran file open options */ LONG append ; LONG trunc ; /* Trunc mode */ int filen ; RFILE *fd ; /* remote file desciptor */ char *host ; /* actual host to be used */ char *filepath; /* actual file path to be used */ char *account; /* account string */ char localhost[MAXHOSTNAMELEN]; int acc, parserc; WORD uid_ext; WORD gid_ext; struct passwd *pw; int rt ; char rfio_buf[BUFSIZ]; INIT_TRACE("RFIO_TRACE"); *irc = 0; TRACE(2,"--->","OPTIONS: %s , %s, %d,%d,%s,%d,%d,%d,%d,%s",name,node,lun,lrecl,chopt,*irc,uid,gid,key,reqhost); /* * First allocate a remote file descriptor */ if ((fd = (RFILE *)malloc(sizeof(RFILE))) == NULL) { END_TRACE(); return(errno); } /* * Analyze options */ access = FFFACC_S; /* Default is access SEQUENTIAL */ format = FFFFORM_U; /* Default is unformatted */ openopt = FFOOPT_0; /* Default is no options */ for (i=0;i< (int)strlen(chopt);i++) { switch (chopt[i]) { case 'u': case 'U': format = FFFFORM_U; break; case 'f': case 'F': free((char *)fd); END_TRACE(); return(SEBADFFORM); case 's': case 'S': access = FFFACC_S; break; case 'd': case 'D': access = FFFACC_D; break; case 'a': case 'A': openopt |= FFOOPT_A; break; case 'e': case 'E': openopt |= FFOOPT_E; break; case ' ': break; default : free((char *)fd); END_TRACE(); return(SEBADFOPT); } } if ((openopt & FFOOPT_A) && (access == FFFACC_D)) { free((char *)fd); END_TRACE(); return(SEINCFOPT); } fd->unit = lun; fd->access = access; fd->format = format; fd->recl = lrecl; fd->blank = FFFBLNK_N; /* currently unsupported */ fd->opnopt = openopt; fd->ftype = FFTYPE_F; fd->passwd = key ; /* * File name parsing */ host = node; filepath = name; striptb(node); if (strcmp(node,"") == 0) { /* empty node, so, it may be a remote file syntax */ if (strcmp(name, "") == 0) { /* empty node & name, it may be assigned */ if ((name=lun2fn(lun)) == NULL) { free((char *)fd); END_TRACE(); return(errno); } } } if (gethostname(localhost, sizeof(localhost)) < 0) { TRACE(2, "rfio", "gethostname () failed."); return(-1); } if ( (strcmp(node,"") == 0) || (strcmp(localhost, node)==0 ) || (strcmp(node,"localhost") == 0)) { /* * The file is local */ if (!(parserc = rfio_parse(name,&host,&filepath))) { strcpy( fd->host , "localhost" ); ftnlun[lun]=fd; filen= strlen(filepath) ; append = openopt & FFOOPT_A; trunc = openopt & FFOOPT_T ; acc=(int)access; *irc=switch_open(&acc,&lun,filepath, &filen, &lrecl, &append,&trunc,LLM); TRACE(2, "rfio", "rxyopen (local) : %d", *irc); END_TRACE(); rfio_errno = 0; return(*irc); } else { if (parserc < 0) { END_TRACE(); return(-1); } } TRACE(3, "rfio", "rfio_xyopen: name %s host %s filepath %s", name, host, filepath); } /* * The only user allowed to make requests with uid !=0 or gid !=0 * is root. */ if (uid!=0 || gid!=0) /* * DIRECT ACCESS: user specifies target */ fd->mapping=0; /* * MAPPED ACCESS: user will be mapped */ else fd->mapping=1; if ( (int)strlen(filepath) > MAXFILENAMSIZE) { free((char *)fd); END_TRACE(); return(SEFNAM2LONG); } strncpy( fd->host , host, RESHOSTNAMELEN ); uid_ext=(WORD)uid; gid_ext=(WORD)gid; /* * Initialize RFILE structure */ fd->magic = RFIO_MAGIC; fd->s = -1; fd->uid = (uid_ext==0 ? geteuid(): uid_ext); fd->gid = (gid_ext==0 ? getegid(): gid_ext); (void) umask(fd->umask=umask(0)); fd->bufsize = 0; fd->ftype = FFTYPE_F; fd->binary = 0; /* no translation needed */ fd->unit = lun; fd->access = access; fd->format = format; fd->recl = lrecl; fd->blank = FFFBLNK_N; /* currently unsupported */ fd->opnopt = openopt; s = rfio_connect(host,&rt); if (s < 0) { free((char *)fd); END_TRACE(); if (serrno) return(serrno); else return(errno); } TRACE(2, "rfio", "rfio_xyopen: setsockopt(SOL_SOCKET, SO_KEEPALIVE)"); status = 1 ; if (setsockopt(fd->s, SOL_SOCKET, SO_KEEPALIVE,(char *)&status , sizeof (int) ) == -1) TRACE(2, "rfio" ,"rfio_xyopen: setsockopt(SO_KEEPALIVE) failed"); if ( !rt && !fd->mapping ) { fd->uid=geteuid() ; fd->gid=getegid() ; TRACE(3,"rfio", "re-setting (uid,gid) to %d,%d",fd->uid,fd->gid) ; fd->mapping = 1 ; } fd->s = s; ftnlun[lun]=fd; if ( (pw = Cgetpwuid(geteuid()) ) == NULL ) { TRACE(2, "rfio" ,"rfio_open: Cgetpwuid() error %s",strerror(errno)); free ((char *)fd); END_TRACE(); return(errno); } /* if ((account = getacct()) == NULL) */ account = ""; TRACE(3, "rfio", "rfio_xyopen: uid %d gid %d umask %o ftype %d user %s", fd->uid, fd->gid, fd->umask, fd->ftype,pw->pw_name); TRACE(3, "rfio", "rfio_xyopen: %d lun %d format %d access %d lrecl", fd->unit, fd->format, fd->access, fd->recl); TRACE(3, "rfio", "rfio_xyopen: account: %s", account); TRACE(3, "rfio", "rfio_xyopen: filepath: %s", filepath); len = 7*WORDSIZE + 4*LONGSIZE + strlen(account) + strlen(filepath) + strlen(pw->pw_name) + strlen(reqhost) + 4 ; p= rfio_buf ; marshall_WORD(p, B_RFIO_MAGIC) ; marshall_WORD(p, RQST_XYOPEN) ; marshall_LONG(p, len) ; p= rfio_buf + RQSTSIZE ; marshall_WORD(p, fd->uid) ; marshall_WORD(p, fd->gid) ; marshall_WORD(p, fd->umask) ; marshall_WORD(p, fd->ftype) ; marshall_LONG(p, fd->unit) ; marshall_WORD(p, fd->format) ; marshall_WORD(p, fd->access) ; marshall_LONG(p, fd->recl) ; marshall_LONG(p, fd->opnopt) ; marshall_STRING(p, account) ; marshall_STRING(p, filepath) ; marshall_STRING(p,pw->pw_name) ; marshall_STRING(p,reqhost); marshall_LONG(p, fd->passwd); marshall_WORD(p, fd->mapping); TRACE(3,"rfio","rfio_xyopen: sending %d bytes",RQSTSIZE+len) ; if (netwrite_timeout(s,rfio_buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { TRACE(3, "rfio", "rfio_xyopen: write(): ERROR occured (errno=%d)", errno); free((char *)fd); ftnlun[lun]=(RFILE *) NULL; return( (serrno ? serrno : errno) ); } TRACE(3, "rfio", "rfio_xyopen: reading %d bytes", LONGSIZE); if (netread_timeout(s,rfio_buf,LONGSIZE,RFIO_CTRL_TIMEOUT) != LONGSIZE) { TRACE(3, "rfio", "rfio_xyopen: read(): ERROR occured (errno=%d)", errno); free((char *)fd); ftnlun[lun]=(RFILE *) NULL; return( (serrno ? serrno : errno) ); } p= rfio_buf ; unmarshall_LONG(p, status); TRACE(2, "rfio", "rfio_xyopen: return %d ",status); if (status) { close(s); free((char *)fd); ftnlun[lun]=(RFILE *) NULL; rfio_errno = status ; } *irc = status; TRACE(1, "rfio", "rfio_xyopen: status: %d, irc: %d",status,*irc); END_TRACE(); return(status); } /* * Fortran wrapper */ #if (defined(hpux) && !defined(PPU)) || (defined(_AIX) && !defined(EXTNAME)) #define xyopen_ xyopen #endif /* hpux && !PPU || AIX && !EXTNAME */ #if defined(_WIN32) void DLL_DECL _stdcall XYOPEN(flun, flrecl, fchopt, fchoptl, firc) #else void xyopen_(flun, flrecl, fchopt, firc, fchoptl) #endif int *flun, *flrecl, *firc; char *fchopt; int fchoptl; { char *chopt; /* "C" character strings */ int status; /* xyopen return status */ INIT_TRACE("RFIO_TRACE"); /* initialize trace if any */ /* * convert fortran arguments */ if ((chopt = malloc(fchoptl+1)) == NULL) { *firc = -errno; return; } strncpy(chopt, fchopt, fchoptl); chopt[fchoptl] = '\0'; TRACE(1,"rfio","XYOPEN(%d,%d,%s,%d)",*flun,*flrecl,chopt,*firc); /* * Here comes real code */ TRACE(1,"rfio","xyopen will return with code %d",*firc); status = rfio_xyopen("","",*flun,*flrecl,chopt,firc); TRACE(1, "rfio", "XYOPEN: status: %d, irc: %d",status,*firc); END_TRACE(); if (status) *firc = -status; /* system errors have precedence */ free(chopt); return; } #if (defined(hpux) && !defined(PPU)) || (defined(_AIX) && !defined(EXTNAME)) #define xyopn_ xyopn #endif /* hpux && !PPU || AIX && !EXTNAME */ #if defined(_WIN32) void DLL_DECL _stdcall XYOPN(fname, fnamel, fnode, fnodel, flun, flrecl, fchopt, fchoptl, firc) #else void xyopn_(fname, fnode, flun, flrecl, fchopt, firc, fnamel, fnodel, fchoptl) #endif int *flun, *flrecl, *firc; char *fname, *fnode, *fchopt; int fnamel, fnodel, fchoptl; { char *name, *node, *chopt; /* "C" character strings */ int status; /* xyopn return status */ INIT_TRACE("RFIO_TRACE"); /* initialize trace if any */ /* * convert fortran arguments */ if ((name = malloc((unsigned) fnamel+1)) == NULL) { *firc = -errno; return; } if ((node = malloc((unsigned) fnodel+1)) == NULL) { *firc = -errno; return; } if ((chopt = malloc((unsigned) fchoptl+1)) == NULL) { *firc = -errno; return; } strncpy(name, fname, fnamel); name[fnamel] = '\0'; strncpy(node, fnode, fnodel); node[fnodel] = '\0'; strncpy(chopt, fchopt, fchoptl); chopt[fchoptl] = '\0'; striptb(name); striptb(node); striptb(chopt); TRACE(1,"rfio","XYOPN(%s, %s, %d, %d, %s, %d)", name,node,*flun,*flrecl,chopt,*firc); status = rfio_xyopen(name,node,*flun,*flrecl,chopt,firc); TRACE(1, "rfio", "XYOPN: status: %d, irc: %d",status,*firc); END_TRACE(); if (status) *firc = -status; /* system errors have precedence */ free(name); free(node); free(chopt); return; } lcgdm-1.10.0/rfio/rfio_fstat64.man0000644000175000017500000000024511332523616016170 0ustar ellertellert.so ./rfio_stat.man .\" @(#)$RCSfile: rfio_fstat64.man,v $ $Revision: 3144 $ $Date: 2010-02-04 11:55:10 +0100 (Thu, 04 Feb 2010) $ CERN IT-PDP/DM Jean-Philippe Baud lcgdm-1.10.0/rfio/fstat.c0000644000175000017500000001316410225414713014447 0ustar ellertellert/* * $Id: fstat.c,v 1.2 2005/04/08 05:42:35 baud Exp $ */ /* * Copyright (C) 1990-2003 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: fstat.c,v $ $Revision: 1.2 $ $Date: 2005/04/08 05:42:35 $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy"; #endif /* not lint */ /* fstat.c Remote File I/O - get file status */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rfilefdt.h" #include /* malloc prototype */ /* * Remote file stat */ int DLL_DECL rfio_fstat(s, statbuf) int s; struct stat *statbuf; { #if (defined(__alpha) && defined(__osf__)) return (rfio_fstat64(s,statbuf)); #else int status ; #if defined(IRIX64) || defined(__ia64__) || defined(__x86_64) || defined(__ppc64__) struct stat64 statb64; if ((status = rfio_fstat64(s,&statb64)) == 0) (void) stat64tostat(&statb64, statbuf); return (status); #else char * p ; char * trp ; int temp=0 ; char rfio_buf[BUFSIZ]; int s_index = -1; /* Avoiding Valgrind error messages about uninitialized data */ memset(rfio_buf, 0, BUFSIZ); INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_fstat(%d, %x)", s, statbuf); /* * The file is local */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1) { TRACE(2, "rfio", "rfio_fstat: using local fstat(%d, %x)", s, statbuf); status = fstat(s, statbuf); if ( status < 0 ) serrno = 0; rfio_errno = 0; END_TRACE(); return(status); } /* * Checking magic number. */ if (rfilefdt[s_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(s_index); (void) close(s) ; END_TRACE(); return(-1); } /* * File mark has to be repositionned. */ if ( (rfilefdt[s_index]->readissued || rfilefdt[s_index]->preseek) && rfilefdt[s_index]->lseekhow == -1 ) { rfilefdt[s_index]->lseekhow= SEEK_SET ; rfilefdt[s_index]->lseekoff= rfilefdt[s_index]->offset ; } /* * Flags on current status are reset. */ rfilefdt[s_index]->eof= 0 ; rfilefdt[s_index]->preseek= 0 ; rfilefdt[s_index]->nbrecord= 0 ; rfilefdt[s_index]->readissued= 0 ; if ( rfilefdt[s_index]->_iobuf.base ) { rfilefdt[s_index]->_iobuf.count= 0 ; rfilefdt[s_index]->_iobuf.ptr= iodata(rfilefdt[s_index]) ; } /* * Sending request. */ p= rfio_buf ; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_FSTAT); /* marshall_LONG(p, rfilefdt[s_index]->lseekhow) ; */ marshall_LONG(p, rfilefdt[s_index]->lseekoff) ; marshall_LONG(p, rfilefdt[s_index]->lseekhow) ; TRACE(2,"rfio","rfio_fstat: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(s,rfio_buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio", "rfio_fstat: write(): ERROR occured (errno=%d)", errno); END_TRACE(); return(-1); } /* * Getting data from the network. */ for(;;) { WORD req ; LONG rcode ; LONG msgsiz ; TRACE(2, "rfio", "rfio_fstat: reading %d bytes",rfilefdt[s_index]->_iobuf.hsize) ; if (netread_timeout(s,rfio_buf,rfilefdt[s_index]->_iobuf.hsize,RFIO_DATA_TIMEOUT) != rfilefdt[s_index]->_iobuf.hsize) { TRACE(2, "rfio", "rfio_fstat: read(): ERROR occured (errno=%d)", errno); if ( temp ) (void) free(trp) ; END_TRACE() ; return -1 ; } p = rfio_buf ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; unmarshall_LONG(p,msgsiz) ; switch(req) { case RQST_FSTAT: TRACE(2, "rfio", "rfio_fstat: reading %d bytes",msgsiz); if (netread_timeout(s,rfio_buf,msgsiz,RFIO_DATA_TIMEOUT) != msgsiz ) { TRACE(2,"rfio","rfio_fstat: read(): ERROR occured (errno=%d)",errno) ; if ( temp ) (void) free(trp) ; END_TRACE() ; return -1 ; } p = rfio_buf ; unmarshall_WORD(p,statbuf->st_dev); unmarshall_LONG(p,statbuf->st_ino); unmarshall_WORD(p,statbuf->st_mode); unmarshall_WORD(p,statbuf->st_nlink); unmarshall_WORD(p,statbuf->st_uid); unmarshall_WORD(p,statbuf->st_gid); unmarshall_LONG(p,statbuf->st_size); unmarshall_LONG(p,statbuf->st_atime); unmarshall_LONG(p,statbuf->st_mtime); unmarshall_LONG(p,statbuf->st_ctime); rfio_errno= rcode ; if ( temp ) (void) free(trp) ; TRACE(1,"rfio","rfio_fstat: return status %d, rcode %d",status,rcode) ; END_TRACE() ; return status ; case RQST_READAHEAD: case RQST_READAHD64: case RQST_LASTSEEK: case RQST_PRESEEK: case RQST_PRESEEK64: /* * At this point a temporary buffer may need to be created * to receive data which is going to be thrown away. */ if ( temp == 0 ) { if ( rfilefdt[s_index]->_iobuf.base==NULL || rfilefdt[s_index]->_iobuf.dsize extern int DLL_DECL switch_read(); int DLL_DECL rfio_xyread(lun, buf, nrec, nwant, ngot, chopt, irc) int lun, nrec, nwant; char *buf, *chopt; int *ngot, *irc; { char buffer[128]; /* general purpose buffer */ register char *p=buf; /* buffer pointer */ register int readopt; /* read options */ int optval; /* setsockopt() value */ register int rbufsiz = 0; /* read buffer size */ int status; /* Fortran status */ int rcode; /* Remote return code */ register int i; /* general purpose index */ int acc; TRACE(1, "rfio", "rfio_xyread(%d, %x, %d, %d, %x, %s, %x)", lun, buf, nrec, nwant, ngot, chopt, irc); if (ftnlun[lun] == (RFILE *) NULL) { /* Allocated ? */ TRACE(1, "rfio", "rfio_xyread: %s", "Bad file number"); END_TRACE(); return(EBADF); } TRACE(2, "rfio", "rfio_xyread: parsing options: [%s]",chopt); readopt = FFREAD_N; for (i=0;i< (int)strlen(chopt);i++) { switch (chopt[i]) { case 'u': case 'U': readopt = FFREAD_C; break; case ' ': break; default : *irc = SEBADFOPT; END_TRACE(); return(SEBADFOPT); } } if (!strcmp(ftnlun[lun]->host, "localhost")) { /* Local file ? */ acc = (int)ftnlun[lun]->access; *irc=switch_read(acc,&lun,buf,&nwant, &nrec, readopt, ngot, LLM ); END_TRACE(); return(*irc); } p = buffer; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_XYREAD); marshall_LONG(p, readopt); marshall_LONG(p, nrec); marshall_LONG(p, nwant); TRACE(2,"rfio","rfio_xyread: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(ftnlun[lun]->s,buffer,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio" ,"rfio_xyread: write(): ERROR occured (errno=%d)", errno); END_TRACE(); if ( serrno ) return ( serrno ) ; else return(errno); } if (rbufsiz < nwant) { optval = nwant; TRACE(2, "rfio", "rfio_xyread: setsockopt(SOL_SOCKET, SO_RCVBUF): %d", optval); if (setsockopt(ftnlun[lun]->s, SOL_SOCKET, SO_RCVBUF, (char *)&optval, sizeof(optval)) == -1) { TRACE(2, "rfio" ,"rfio_xyread: setsockopt(SO_RCVBUF): ERROR"); } } TRACE(2,"rfio","rfio_xyread: reading %d bytes",3*LONGSIZE) ; if (netread_timeout(ftnlun[lun]->s, buffer, 3*LONGSIZE, RFIO_CTRL_TIMEOUT) != (3*LONGSIZE)) { TRACE(2,"rfio","rfio_xyread: read(): ERROR occured (errno=%d)",errno) ; END_TRACE(); if ( serrno ) return (serrno) ; else return(errno); } p = buffer; unmarshall_LONG(p, status); unmarshall_LONG(p, rcode); unmarshall_LONG(p, *ngot); if ( *ngot ) { TRACE(2, "rfio", "rfio_xyread: reading %d bytes", *ngot); if (netread_timeout(ftnlun[lun]->s, buf, *ngot, RFIO_DATA_TIMEOUT) != *ngot) { TRACE(2, "rfio" ,"rfio_xyread: read(): ERROR occured (errno=%d)", errno); END_TRACE(); if ( serrno ) return ( serrno ) ; else return(errno); } } TRACE(1, "rfio", "rfio_xyread: status %d, rcode %d", status, rcode) ; if ( rcode > SEBASEOFF ) serrno = rcode ; else rfio_errno= rcode; return(*irc = status); } /* * Fortran wrapper */ #if (defined(hpux) && !defined(PPU)) || (defined(_AIX) && !defined(EXTNAME)) #define xyread_ xyread #endif /* hpux && !PPU || AIX && !EXTNAME */ #if defined(_WIN32) void DLL_DECL _stdcall XYREAD(flun, fbuf, fnrec, fnwant, fngot, fchopt, fchoptl, firc) #else void xyread_(flun, fbuf, fnrec, fnwant, fngot, fchopt, firc, fchoptl) #endif int *flun, *fnrec, *fnwant, *fngot, *firc; char *fbuf, *fchopt; int fchoptl; { char *chopt; /* xyread options */ int status; /* xyread return status */ INIT_TRACE("RFIO_TRACE"); if ((chopt = malloc((unsigned) fchoptl+1)) == NULL) { *firc = -errno; END_TRACE(); return; } strncpy(chopt, fchopt, fchoptl); chopt[fchoptl] = '\0'; TRACE(1, "rfio", "XYREAD(%d, %x, %d, %d, %x, %s, %x)", *flun, fbuf, *fnrec, *fnwant, fngot, chopt, firc); status = rfio_xyread(*flun, fbuf, *fnrec, *fnwant, fngot, chopt, firc); if (status) *firc = -status; /* system errors have precedence */ TRACE(1, "rfio", "XYREAD: status: %d, irc: %d",status,*firc); END_TRACE(); (void) free(chopt); return; } lcgdm-1.10.0/rfio/rfio_rewinddir.man0000644000175000017500000000230710222773541016666 0ustar ellertellert.\" .\" $Id: rfio_rewinddir.man,v 1.1 2005/03/31 13:13:03 baud Exp $ .\" .\" @(#)$RCSfile: rfio_rewinddir.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2001 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_REWINDDIR 3 "$Date: 2005/03/31 13:13:03 $" CASTOR "Rfio Library Functions" .SH NAME rfio_rewinddir \- reset position to the beginning of a directory opened by .B rfio_opendir .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "void rfio_rewinddir (RDIR *" dirp ");" .SH DESCRIPTION .B rfio_rewinddir resets the position to the beginning of a directory opened by .BR rfio_opendir . .TP .I dirp specifies the pointer value returned by .BR rfio_opendir . .SH NOTES For CASTOR directories, a multi-threaded application will need to initialize itself the Cthread (CASTOR Thread Interface) library ; this is done by including "shift/Cthread_api.h" and calling the function Cthread_init() at the beginning. Otherwise accessing CASTOR directories will not be thread-safe. See \fBCthread\fP(3). .SH SEE ALSO .BR rfio_closedir(3) , .BR rfio_opendir(3) , .BR rfio_readdir(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfdir.man0000644000175000017500000000226711576107216014776 0ustar ellertellert.\" .\" $Id: rfdir.man 4462 2011-06-15 10:50:54Z baud $ .\" .\" @(#)rfdir.man 1.2 09/21/98 CERN IT-PDP/DM Olof Barring .\" Copyright (C) 1998-2011 by CERN/IT/PDP .\" All rights reserved .\" .TH RFDIR 1 "$Date: 2011-06-15 12:50:54 +0200 (Wed, 15 Jun 2011) $" CASTOR "Rfio User Commands" .SH NAME rfdir \- Remote directory list .SH SYNOPSIS .B rfdir .IR directory .br .B rfdir .IR filename .SH DESCRIPTION .IX "\fLrfdir\fR" The remote directory list program provides an interface to the .B shift remote file I/O daemon (rfiod) for listing a remote directory or file. The .IR filename or .IR directory argument is either a remote file name of the form: .IP .IB hostname : path .LP or a local file name (not containing the :/ character combination). The output from the .BR rfdir command is a full directory listing similar to that of the .BR "ls -al" command for listing local files or directories. .SH "SEE ALSO" .BR rcp(1), .BR rfiod(1) .SH "NOTES" .B rfdir does not support regular expressions .BR (regexp(5)) in the .IR directory or .IR filename argument. .LP The date and time displayed by .B rfdir are for the last modification to the file. .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_fopen64.man0000644000175000017500000000021410222773541016153 0ustar ellertellert.so ./rfio_fopen.man .\" @(#)$RCSfile: rfio_fopen64.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:02 $ CERN IT-PDP/DM Jean-Philippe Baud lcgdm-1.10.0/rfio/readlink.c0000644000175000017500000000677610222773541015136 0ustar ellertellert/* * $Id: readlink.c,v 1.1 2005/03/31 13:13:01 baud Exp $ */ /* * Copyright (C) 1994-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: readlink.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:01 $ CERN/IT/PDP/DM Felix Hassine"; #endif /* not lint */ #define RFIO_KERNEL 1 #include "rfio.h" int DLL_DECL rfio_readlink(path,buf, length) char *path ; char *buf ; int length ; { int c; int status ; int s ; char *host ; char * filename; char *p ; int rt ; int rcode , len, parserc; int uid ; int gid ; char buffer[BUFSIZ]; char tmpbuf[MAXFILENAMSIZE]; /* * The file is local. */ INIT_TRACE("RFIO_TRACE"); TRACE( 1, "rfio", " rfio_readlink (%s,%x,%d)",path,buf,length); if ( ! (parserc = rfio_parseln(path,&host,&filename,NORDLINKS)) ) { #if !defined(_WIN32) status = readlink(filename,buf,length) ; if ( status < 0 ) serrno = 0; #else { serrno = SEOPNOTSUP; status = -1; } #endif END_TRACE() ; rfio_errno = 0; return status ; } if (parserc < 0) { END_TRACE(); return(-1); } s = rfio_connect(host,&rt); if (s < 0) { END_TRACE(); return(-1); } uid = geteuid() ; gid = getegid () ; p = buffer ; marshall_WORD(p, B_RFIO_MAGIC); marshall_WORD(p, RQST_READLINK); status = 2*WORDSIZE + strlen(path) + 1; marshall_LONG(p, status) ; if ( status > BUFSIZ ) { TRACE(2,"rfio","rfio_readlink: request too long %d (max %d)", status,BUFSIZ); END_TRACE(); (void) netclose(s); serrno = E2BIG; return(-1); } if (netwrite_timeout(s,buffer,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio", "readlink: write(): ERROR occured (errno=%d)",errno); (void) netclose(s); END_TRACE(); return(-1); } p = buffer ; marshall_WORD(p,uid) ; marshall_WORD(p,gid) ; marshall_STRING(p,filename) ; if (netwrite_timeout(s,buffer,status,RFIO_CTRL_TIMEOUT) != status ) { TRACE(2, "rfio", "readlink(): write(): ERROR occured (errno=%d)",errno); (void) netclose(s); END_TRACE(); return(-1); } /* * Getting back status */ if ((c=netread_timeout(s, buffer, 3*LONGSIZE, RFIO_CTRL_TIMEOUT)) != (3*LONGSIZE)) { if (c == 0) { serrno = SEOPNOTSUP; /* symbolic links not supported on remote machine */ TRACE(2, "rfio", "rfio_readlink: read(): ERROR occured (serrno=%d)", serrno); } else TRACE(2, "rfio", "rfio_readlink: read(): ERROR occured (errno=%d)", errno); (void) netclose(s); END_TRACE(); return(-1); } p = buffer; unmarshall_LONG( p, len ); unmarshall_LONG( p, status ) ; unmarshall_LONG( p, rcode ) ; if ( status < 0 ) { TRACE(1,"rfio","rfio_readlink(): rcode = %d , status = %d",rcode, status); rfio_errno = rcode ; (void) netclose(s); END_TRACE(); return(status); } /* Length is not of a long size, so RFIO_CTRL_TIMEOUT is enough */ if (netread_timeout(s, buffer, len, RFIO_CTRL_TIMEOUT) != len) { TRACE(2, "rfio", "rfio_readlink: read(): ERROR occured (errno=%d)", errno); (void) netclose(s); END_TRACE(); return(-1); } p = buffer ; if (rcode < length) { unmarshall_STRING( p, buf ) ; } else { unmarshall_STRINGN( p, tmpbuf, MAXFILENAMSIZE) ; memcpy (buf, tmpbuf, length) ; } TRACE (2,"rfio","rfio_readlink succeded: returned %s",buf); END_TRACE(); (void) netclose (s) ; return(rcode) ; } lcgdm-1.10.0/rfio/rcp.c0000644000175000017500000000635411436650662014127 0ustar ellertellert/* * $Id: rcp.c 3764 2010-08-30 06:37:38Z baud $ */ /* * Copyright (C) 2009-2010 by CERN/IT/GS * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rcp.c $ $Revision: 3764 $ $Date: 2010-08-30 08:37:38 +0200 (Mon, 30 Aug 2010) $ CERN/IT/GS Jean-Philippe Baud"; #endif /* not lint */ /* rfio_rcp.c Remote File I/O - third party copy of a file */ #define RFIO_KERNEL 1 /* KERNEL part of the routines */ #include "rfio.h" /* Remote File I/O general definitions */ int DLL_DECL rfio_rcp(source, destination, timeout) char *source; char *destination; int timeout; { char buf[BUFSIZ]; /* General input/output buffer */ mode_t curmask; char *host; int len; char *p=buf; char *path; int rcode; int rpd; int rps; int rt; int s; /* socket descriptor */ char server[CA_MAXHOSTNAMELEN+1]; int status; /* remote method status */ (void) umask(curmask=umask(0)); INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_rcp(%s, %s)", source, destination); *server = '\0'; if ((rps = rfio_parse(source, &host, &path)) < 0) { END_TRACE(); return(-1); } if (rps == 0 && host) { /* sfn is currently not supported */ serrno = SEOPNOTSUP; END_TRACE(); return(-1); } if (rps) strcpy(server, host); if ((rpd = rfio_parse(destination, &host, &path)) < 0) { END_TRACE(); return(-1); } if (rpd == 0 && host) { /* sfn is currently not supported */ serrno = SEOPNOTSUP; END_TRACE(); return(-1); } if (rpd && ! *server) strcpy(server, host); if (! *server) gethostname(server, sizeof(server)); s = rfio_connect(server,&rt); if (s < 0) { END_TRACE(); return(-1); } len = strlen(source) + strlen(destination) + 2; if ( RQSTSIZE+len > BUFSIZ ) { TRACE(2,"rfio","rfio_rcp: request too long %d (max %d)", RQSTSIZE+len,BUFSIZ); END_TRACE(); (void) netclose(s); serrno = E2BIG; return(-1); } marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_RCP); marshall_WORD(p, geteuid()); marshall_WORD(p, getegid()); marshall_WORD(p, curmask); marshall_LONG(p, timeout); marshall_LONG(p, len); p= buf + RQSTSIZE; marshall_STRING(p, source); marshall_STRING(p, destination); TRACE(1,"rfio","rfio_rcp: source %s, destination %s", source, destination); TRACE(2,"rfio","rfio_rcp: sending %d bytes",RQSTSIZE+len) ; if (netwrite_timeout(s,buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { TRACE(2, "rfio", "rfio_rcp: write(): ERROR occured (errno=%d)", errno); (void) netclose(s); END_TRACE(); return(-1); } p = buf; TRACE(2, "rfio", "rfio_rcp: reading %d bytes", LONGSIZE); if (netread_timeout(s, buf, 2 * LONGSIZE, timeout) != (2 * LONGSIZE)) { TRACE(2, "rfio", "rfio_rcp: read(): ERROR occured (errno=%d)", errno); (void) netclose(s); END_TRACE(); return(-1); } unmarshall_LONG(p, status); unmarshall_LONG(p, rcode); TRACE(1, "rfio", "rfio_rcp: return %d",status); rfio_errno = rcode; (void) netclose(s); if (status) { END_TRACE(); return(-1); } END_TRACE(); return (0); } lcgdm-1.10.0/rfio/rfio_lseek64.man0000644000175000017500000000021410222773541016147 0ustar ellertellert.so ./rfio_lseek.man .\" @(#)$RCSfile: rfio_lseek64.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud lcgdm-1.10.0/rfio/rfio_read.man0000644000175000017500000000243410222773541015613 0ustar ellertellert.\" .\" $Id: rfio_read.man,v 1.1 2005/03/31 13:13:03 baud Exp $ .\" .\" @(#)$RCSfile: rfio_read.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2001 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_READ 3 "$Date: 2005/03/31 13:13:03 $" CASTOR "Rfio Library Functions" .SH NAME rfio_read \- reads in a file .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_read (int " s ", void *" ptr ", int " size ");" .SH DESCRIPTION .B rfio_read reads in the file and store in .BR ptr , a pointer to the memory location in which to place the information, .BI size bytes, using the descriptor .BI s generated by a previous .BR rfio_open . .SH RETURN VALUE This routine returns -1 if the operation failed or the number of bytes actually read. In case of failure, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EBADF .I s is not a valid descriptor. .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SETIMEDOUT Timed out. .TP .B SEBADVERSION Version ID mismatch. .TP .B SECONNDROP Connection closed by remote end. .TP .B SECOMERR Communication error. .TP .B SENORCODE Host did not return error number. .SH SEE ALSO .BR rfio_open(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/ftell.c0000644000175000017500000000310011533400617014422 0ustar ellertellert/* * $Id: ftell.c 4148 2011-03-02 08:36:31Z baud $ */ /* * Copyright (C) 1990-2011 by IN2P3 CC Philippe Gaillardon * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: ftell.c,v $ $Revision: 4148 $ $Date: 2011-03-02 09:36:31 +0100 (Wed, 02 Mar 2011) $ IN2P3 CC Philippe Gaillardon"; #endif /* not lint */ /* ftell.c Remote File I/O - get current file position. */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rfilefdt.h" #include long rfio_ftell(fp) RFILE *fp; { long rc; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_ftell(%x)", fp); /* * Checking fp validity */ if (fp == NULL) { errno = EBADF; TRACE(2,"rfio","rfio_ftell() : FILE ptr is NULL "); END_TRACE(); return -1; } /* * The file is local : this is the only way to detect it ! */ if (rfio_rfilefdt_findptr(fp,FINDRFILE_WITH_SCAN) == -1) { TRACE(2,"rfio","rfio_ftell() : using local ftell() "); rc = ftell((FILE *)fp); if ( rc < 0 ) serrno = 0; rfio_errno = 0; END_TRACE(); return rc; } TRACE(2,"rfio","rfio_ftell() : after remoteio") ; /* * Checking magic number */ if (fp->magic != RFIO_MAGIC) { int fps = fp->s; serrno = SEBADVERSION; TRACE(2,"rfio","rfio_ftell() : Bad magic number"); free((char *)fp); (void) close(fps); END_TRACE(); return -1; } /* Just use rfio_lseek */ rc = rfio_lseek(fp->s, 0, SEEK_CUR); END_TRACE(); return rc; } lcgdm-1.10.0/rfio/rfstat.c0000644000175000017500000001072111332757053014634 0ustar ellertellert/* * $Id: rfstat.c 3154 2010-02-05 09:00:27Z baud $ */ /* * Copyright (C) 1990-2009 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rfstat.c,v $ $Revision: 3154 $ $Date: 2010-02-05 10:00:27 +0100 (Fri, 05 Feb 2010) $ CERN/IT/PDP/DM fhe"; #endif /* not lint */ #include #include #include #include #include #include #include #include #if defined(_WIN32) #include #include #endif #ifdef VIRTUAL_ID #include #endif #include int is_cns_path; void report_mode(mode) unsigned int mode; { static char letters[11]="----------"; register unsigned int m; register char c; /* * File type */ m = mode&S_IFMT; switch (m) { case S_IFDIR: c = 'd'; break; case S_IFCHR: c = 'c'; break; case S_IFBLK: c = 'b'; break; case S_IFREG: c = '-'; break; case S_IFLNK: c = 'l'; break; case S_IFSOCK: c = 's'; break; #if defined(_WIN32) case _S_IFIFO: c = 'p'; break; #else #if defined(__Lynx__) case S_IFFIFO: c = 'p'; break; #else case S_IFIFO: c = 'p'; break; #endif #endif default : c = '?'; } letters[0]=c; if (mode&S_IREAD) letters[1]='r'; if (mode&S_IWRITE) letters[2]='w'; if (mode&S_ISUID) { if (mode&S_ISVTX) { if (mode&S_IEXEC) letters[3]='s'; else letters[3]='S'; } else { if (mode&S_IEXEC) letters[3]='s'; else letters[3]='-'; } } else { if (mode&S_IEXEC) letters[3]='x'; else letters[3]='-'; } if (mode&S_IRGRP) letters[4]='r'; if (mode&S_IWGRP) letters[5]='w'; if (mode&S_ISGID) { if (mode&S_ISVTX) { if (mode&S_IXGRP) letters[6]='s'; else letters[6]='S'; } else { if (mode&S_IXGRP) letters[6]='s'; else letters[6]='-'; } if (mode&S_IXGRP) letters[6]='s'; else letters[6]='-'; } else { if (mode&S_IXGRP) letters[6]='x'; else letters[6]='-'; } if (mode & S_IROTH) letters[7]='r'; if (mode & S_IWOTH) letters[8]='w'; if (mode & S_IXOTH) letters[9]='x'; if (mode&S_ISVTX) letters[9]='t'; fprintf(stdout,"Protection : %s (%o)\n",letters,mode); } void report(buf) struct stat64 *buf; { char idstr[256]; struct passwd *pwd; struct group *grp; char tmpbuf[21]; fprintf(stdout,"Device : %x\n",(int) buf->st_dev); fprintf(stdout,"Inode number : %d\n",(int) buf->st_ino); #if !defined(_WIN32) fprintf(stdout,"Nb blocks : %d\n",(int) buf->st_blocks); #endif /* _WIN32 */ report_mode(buf->st_mode); fprintf(stdout,"Hard Links : %d\n",(int) buf->st_nlink); #ifdef VIRTUAL_ID if (is_cns_path && buf->st_uid) { if (Cns_getusrbyuid (buf->st_uid, idstr) == 0) fprintf(stdout,"Uid : %d (%s)\n",(int) buf->st_uid,idstr); else fprintf(stdout,"Uid : %d (UNKNOWN)\n",(int) buf->st_uid); } else { #else { #endif if (pwd = getpwuid(buf->st_uid)) fprintf(stdout,"Uid : %d (%s)\n",(int) buf->st_uid,pwd->pw_name); else fprintf(stdout,"Uid : %d (UNKNOWN)\n",(int) buf->st_uid); } #ifdef VIRTUAL_ID if (is_cns_path && buf->st_gid) { if (Cns_getgrpbygid (buf->st_gid, idstr) == 0) fprintf(stdout,"Gid : %d (%s)\n",(int) buf->st_gid,idstr); else fprintf(stdout,"Gid : %d (UNKNOWN)\n",(int) buf->st_gid); } else { #else { #endif if (grp = getgrgid(buf->st_gid)) fprintf(stdout,"Gid : %d (%s)\n",(int) buf->st_gid,grp->gr_name); else fprintf(stdout,"Gid : %d (UNKNOWN)\n",(int) buf->st_gid); } fprintf(stdout,"Size (bytes) : %s\n", u64tostr(buf->st_size, tmpbuf, 0)); fprintf(stdout,"Last access : %s",ctime(&buf->st_atime)); fprintf(stdout,"Last modify : %s",ctime(&buf->st_mtime)); fprintf(stdout,"Last stat. mod. : %s",ctime(&buf->st_ctime)); } main(argc,argv) int argc; char **argv; { struct stat64 buf; char *filename; char *host; #if defined(_WIN32) WSADATA wsadata; #endif if (argc != 2) { fprintf(stderr,"usage: %s \n",argv[0]); exit(1); } #if defined(_WIN32) if (WSAStartup (MAKEWORD (2, 0), &wsadata)) { fprintf (stderr, "WSAStartup unsuccessful\n"); exit (2); } #endif if (rfio_stat64(argv[1],&buf) < 0) { rfio_perror(argv[1]); #if defined(_WIN32) WSACleanup(); #endif exit(1); } #ifdef VIRTUAL_ID is_cns_path = rfio_parse(argv[1],&host,&filename) == 0 && host; #endif report(&buf); #if defined(_WIN32) WSACleanup(); #endif exit(0); } lcgdm-1.10.0/rfio/rfio_rdirfdt.c0000644000175000017500000000726010222773541016007 0ustar ellertellert/* * $Id: rfio_rdirfdt.c,v 1.1 2005/03/31 13:13:03 baud Exp $ */ /* * System remote file I/O */ #ifdef _WIN32 #include "Cmutex.h" #endif #define RFIO_KERNEL 1 #include #if defined(_WIN32) #define MAXHOSTNAMELEN 64 #else #include /* For MAXHOSTNAMELEN definition */ #endif #include #include "rfio.h" #include "rfio_rdirfdt.h" extern RDIR *rdirfdt[MAXRFD]; RDIR dummyrdir; /* Used to fill index */ /* * Seach for a free index in the rdirfdt table */ int DLL_DECL rfio_rdirfdt_allocentry(s) int s; { #ifdef _WIN32 int i; int rc; if (Cmutex_lock((void *) rdirfdt,-1) != 0) { return(-1); } /* Scan it */ for (i = 0; i < MAXRFD; i++) { if (rdirfdt[i] == NULL) { rc = i; rdirfdt[i] = &dummyrdir; goto _rfio_rdirfdt_allocentry_return; } } serrno = ENOENT; rc = -1; _rfio_rdirfdt_allocentry_return: if (Cmutex_unlock((void *) rdirfdt) != 0) { return(-1); } return(rc); #else /* _WIN32 */ return(((s >= 0) && (s < MAXRFD)) ? s : -1); #endif } /* * Seach for a given index in the rdirfdt table * On UNIX, if scanflag is FINDRDIR_WITH_SCAN, * a scan of table content is performed, otherwise * only boundary and content within the boundary * is performed. */ int DLL_DECL rfio_rdirfdt_findentry(s,scanflag) int s; int scanflag; { int i; #ifdef _WIN32 int rc; if (Cmutex_lock((void *) rdirfdt,-1) != 0) { return(-1); } /* Scan it */ for (i = 0; i < MAXRFD; i++) { if (rdirfdt[i] != NULL) { if (rdirfdt[i]->s == s) { rc = i; goto _rfio_rdirfdt_findentry_return; } } } serrno = ENOENT; rc = -1; _rfio_rdirfdt_findentry_return: if (Cmutex_unlock((void *) rdirfdt) != 0) { return(-1); } return(rc); #else /* _WIN32 */ if (scanflag == FINDRDIR_WITH_SCAN) { for (i = 0; i < MAXRFD; i++) { if (rdirfdt[i] != NULL) { if (rdirfdt[i]->s == s) { return(i); } } } return(-1); } else { return(((s >= 0) && (s < MAXRFD) && (rdirfdt[s] != NULL)) ? s : -1); } #endif /* _WIN32 */ } /* * Seach for a given pointer in the rdirfdt table * On UNIX, if scanflag is FINDRDIR_WITH_SCAN, * a scan of table content is performed, otherwise * only boundary and content within the boundary * is performed. */ int DLL_DECL rfio_rdirfdt_findptr(ptr,scanflag) RDIR *ptr; int scanflag; { int i; #ifdef _WIN32 int rc; if (Cmutex_lock((void *) rdirfdt,-1) != 0) { return(-1); } /* Scan it */ for (i = 0; i < MAXRFD; i++) { if (rdirfdt[i] == ptr) { rc = i; goto _rfio_rdirfdt_findentry_return; } } serrno = ENOENT; rc = -1; _rfio_rdirfdt_findentry_return: if (Cmutex_unlock((void *) rdirfdt) != 0) { return(-1); } return(rc); #else /* _WIN32 */ if (scanflag == FINDRDIR_WITH_SCAN) { for (i = 0; i < MAXRFD; i++) { if (rdirfdt[i] == ptr) { return(i); } } return(-1); } else { /* This method works only in FINDRDIR_WITH_SCAN mode */ serrno = EINVAL; return(-1); } #endif /* _WIN32 */ } /* * Free a given index in the rdirfdt table * Warning : the argument is REALLY an index */ int DLL_DECL rfio_rdirfdt_freeentry(s) int s; { #ifdef _WIN32 if (Cmutex_lock((void *) rdirfdt,-1) != 0) { return(-1); } if (rdirfdt[s] != NULL) { if (rdirfdt[s] != &dummyrdir) free(rdirfdt[s]); rdirfdt[s] = NULL; } if (Cmutex_unlock((void *) rdirfdt) != 0) { return(-1); } #else /* _WIN32 */ if ((s >= 0) && (s < MAXRFD) && (rdirfdt[s] != NULL)) { if (rdirfdt[s] != &dummyrdir) free((char *)rdirfdt[s]); rdirfdt[s] = NULL; } #endif /* _WIN32 */ return(0); } lcgdm-1.10.0/rfio/rfcat.man0000644000175000017500000000227611531456314014764 0ustar ellertellert.\" .\" $Id: rfcat.man,v 1.1 2005/03/31 13:13:01 baud Exp $ .\" .\" @(#)$RCSfile: rfcat.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:01 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 2001-2011 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFCAT 1 "$Date: 2005/03/31 13:13:01 $" CASTOR "Rfio User Commands" .SH NAME rfcat \- Remote file concatenation to standard output .SH SYNOPSIS .B rfcat .IR filename1 .IR [filename2[...]] .SH DESCRIPTION .IX "\fLrfcat\fR" The remote file I/O concatenation program provides an interface to the .B CASTOR remote file I/O daemon (rfiod) for concatenating files from remote and/or local hosts to standard output. Each .IR filename argument is either a remote file name of the form: .IP .IB hostname : path .LP or a local file name (not containing the :/ character combination) .LP or an HSM filename /castor/... .LP With no filename, or when .I filename is -, read standard input. The streaming mode (v3) is used. .SH RETURN CODES \ .br 0 Ok. .br 1 Bad parameter. .br 2 System error. .br 16 Device or resource busy. .br 28 No space left on device. .br 196 Request killed. .SH SEE ALSO .BR cat(1), .BR rfiod(1) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_unlink.man0000644000175000017500000000663210222773541016204 0ustar ellertellert.\" .\" $Id: rfio_unlink.man,v 1.1 2005/03/31 13:13:04 baud Exp $ .\" .\" @(#)$RCSfile: rfio_unlink.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:04 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2001 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_UNLINK 3 "$Date: 2005/03/31 13:13:04 $" CASTOR "Rfio Library Functions" .SH NAME rfio_unlink \- remove a file entry .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_unlink (const char *" path ");" .br .BI "int rfio_munlink (const char *" path ");" .br .BI "int rfio_munlink_reset ();" .br .BI "int rfio_unend ();" .br .SH DESCRIPTION .B rfio_unlink removes a file entry. .TP .I path specifies the logical pathname relative to the current directory or the full pathname. .LP .B rfio_munlink is identical to .B rfio_unlink but keeps the connection open to the server unless there are more than MAXMCON connections already opened. This is useful when issuing a series of unlink calls. The last .B rfio_munlink call should be followed by a call to .BR rfio_unend . .LP .B rfio_munlink_reset is to be used when your program is forking. In such a case the permanent connections opened with .B rfio_munlink become shared between the parent and the child. Use .B rfio_munlink_reset to perform the necessary reset and close of the socket file descriptor in the parent or the child in order to be sure that only of them will receice an answer from the RFIO daemon. .LP .B rfio_munlink_reset is to be used when your program is forking. In such a case the permanent connections opened with .B rfio_munlink become shared between the parent and the child. Use .B rfio_munlink_reset to perform the necessary reset and close of the socket file descriptor in the parent or the child in order to be sure that only of them will receice an answer from the RFIO daemon. .P See NOTES section below. .SH RETURN VALUE This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH NOTES Multiple connections using rfio_munlink are thread-safe but not process-wide, therefore a forked child cann share file descriptors opened with rfio_munlink by its parent. Use .B rfio_msymlink_reset in such case. .P Multiple connections behaviour is undefined if you work in a multi-threaded environment and with threads \fBnot\fP created using the CASTOR's \fBCthread\fP interface. .SH ERRORS .TP 1.3i .B EPERM .I path is a directory. .TP .B ENOENT The named file does not exist or is a null pathname. .TP .B EACCES Search permission is denied on a component of the .IR path prefix or write permission is denied on the parent directory or the parent has the sticky bit S_ISVTX set and .RS 1.5i .LP the effective user ID of the requestor does not match the owner ID of the file and .LP the effective user ID of the requestor does not match the owner ID of the directory and .LP the file is not writable by the requestor and .LP the requestor is not super-user. .RE .TP .B EFAULT .I path is a NULL pointer. .TP .B ENOTDIR A component of .I path prefix is not a directory. .TP .B ENAMETOOLONG The length of .I path exceeds .B CA_MAXPATHLEN or the length of a .I path component exceeds .BR CA_MAXNAMELEN . .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR Castor_limits(4) , .BR rfio_rmdir(3) , .BR Cthread(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfchmod.c0000644000175000017500000000517211336205452014752 0ustar ellertellert/* * $Id: rfchmod.c 3172 2010-02-15 08:51:54Z baud $ */ /* * Copyright (C) 1998-2010 by IN2P3 CC * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rfchmod.c,v $ $Revision: 3172 $ $Date: 2010-02-15 09:51:54 +0100 (Mon, 15 Feb 2010) $ IN2P3 CC Philippe Gaillardon"; #endif /* not lint */ /* * Change mode of a file */ #include #include #include #include #include #if defined(_WIN32) #include #endif /* _WIN32 */ #include static char *ckpath(); char *getconfent(); static char *cmdid; /* Command Id */ /* Summary help */ void help(int rcode) { fprintf(stderr,"Usage: %s absolute-mode filename ...\n", cmdid); exit(rcode); } int main(argc, argv) int argc; char *argv[]; { extern char * optarg ; extern int optind ; int recursive = 0; char *path,*root_path,*p; int rc; int exit_rc = 0; int c; mode_t mode = 0777; long int lmode = 0; /* For conversion, then casting to mode IN2P3*/ char *endprt; /* For conversion IN2P3*/ struct stat st; #if defined(_WIN32) WSADATA wsadata; #endif cmdid = argv[0]; /* Options decoding */ while ( (c = getopt(argc,argv,"")) != EOF ) { switch(c) { case '?': help(2); } } /* First argument is permission mode in octal */ if ( optind >= argc ) { fprintf(stderr,"Missing access mode\n"); help(2); } lmode = strtol(argv[optind], &endprt, 8); if ( lmode > 0 && lmode <= 0777 && *endprt == '\0' ) mode = lmode; else { fprintf(stderr, "Invalid mode '%s'.\n", argv[optind]); help(2); } optind++; /* the next arguments are a list of file names */ if ( optind >= argc ) { fprintf(stderr,"Missing file name\n"); help(2); } #if defined(_WIN32) if (WSAStartup (MAKEWORD (2, 0), &wsadata)) { fprintf (stderr, "WSAStartup unsuccessful\n"); exit (2); } #endif for (;optind .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_chown (const char *" path , .BI "uid_t " new_uid , .BI "gid_t " new_gid ) .SH DESCRIPTION .B rfio_chown sets the owner and the group of a directory/file to the numeric values in .I owner and .I group respectively. If .I owner or .I group is specified as -1, .B rfio_chown() does not change the corresponding ID of the file. .TP .I path specifies the logical pathname relative to the current directory or the full pathname. .LP The effective user ID of the process must match the owner of the file or be super-user. .SH RETURN VALUE This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EPERM The effective user ID does not match the owner of the file and is not super-user. .TP .B ENOENT The named file/directory does not exist or is a null pathname. .TP .B EACCES Search permission is denied on a component of the .I path prefix or write permission on the file itself is denied. .TP .B EFAULT .I path is a NULL pointer. .TP .B ENOTDIR A component of .I path prefix is not a directory. .TP .B EINVAL .I new_uid or .I new_gid is invalid. .TP .B ENAMETOOLONG The length of .I path exceeds .B CA_MAXPATHLEN or the length of a .I path component exceeds .BR CA_MAXNAMELEN . .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SETIMEDOUT Timed out. .TP .B SECONNDROP Connection closed by remote end. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR Castor_limits(4) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_preseek.man0000644000175000017500000001210510222773541016332 0ustar ellertellert.\" .\" $Id: rfio_preseek.man,v 1.1 2005/03/31 13:13:03 baud Exp $ .\" .\" @(#)$RCSfile: rfio_preseek.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1990-2002 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_PRESEEK 3 "$Date: 2005/03/31 13:13:03 $" CASTOR "Rfio Library Functions" .SH NAME rfio_preseek \- prefetch chunks of data from a file .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_preseek (int " s ", const struct iovec *" iov ", int " iovnb ");" .sp Under Linux, for large files: .br .B #define _LARGEFILE64_SOURCE .br .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_preseek64 (int " s ", const struct iovec64 *" iov ", int " iovnb ");" .br .sp For large files, under other systems: .br .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_preseek64 (int " s ", const struct iovec64 *" iov ", int " iovnb ");" .SH DESCRIPTION .B rfio_preseek prefetches chunks of data at given offsets into an internal buffer (on the client side), using the descriptor .BI s generated by a previous .BR rfio_open . The actual offset values and the lengths are given in the array of structures .BR iov . The number of chunks is specified by .BR iovnb . .LP .B rfio_preseek64 does the prefetch for large files, using an array of structures of type .BR iovec64 rather than an array of .BR iovec . .LP .B RFIO_READOPT must be set to RFIO_READBUF, which is the default. The default internal buffer size is 128 kB, but the buffer size can be set with an entry RFIO IOBUFSIZE in .BR shift.conf . Then .B rfio_read gets the data from that buffer. .SH EXAMPLES .nf .ft CW /* tpreseek - write NBRECORDS_TOWRITE records and read back NBRECORDS_TOREAD using the rfio_preseek function */ #include #include #if defined(_WIN32) #include #endif #include "rfio_api.h" #define NBRECORDS_TOREAD 5 #define NBRECORDS_TOWRITE 10 main(argc, argv) int argc; char **argv; { char buf[65536]; int errflg = 0; int fd; int i; struct iovec iov[NBRECORDS_TOREAD]; int iovnb = NBRECORDS_TOREAD; int j; static int lengths[NBRECORDS_TOWRITE] = {4096, 32768, 16384, 8192, 65536, 32768, 16384, 4096, 65536, 8192}; static int records_toread[NBRECORDS_TOREAD] = {2, 4, 5, 8, 9}; #if defined(_WIN32) WSADATA wsadata; #endif if (argc != 2) { fprintf (stderr, "usage: tpreseek pathname\\n"); exit (1); } #if defined(_WIN32) if (WSAStartup (MAKEWORD (2, 0), &wsadata)) { fprintf (stderr, "WSAStartup unsuccessful\\n"); exit (2); } #endif while (! errflg) { /* Write variable length records. * Each record is filled with the record index */ if ((fd = rfio_open (argv[1], O_WRONLY|O_CREAT|O_TRUNC, 0644)) < 0) { rfio_perror ("rfio_open"); errflg++; break; } for (j = 0; j < NBRECORDS_TOWRITE; j++) { for (i = 0; i < lengths[j]; i++) buf[i] = j; if (rfio_write (fd, buf, lengths[j]) < 0) { rfio_perror ("rfio_write"); errflg++; break; } } (void)rfio_close (fd); if (errflg) break; /* Prefetch a few records: the actual offsets and lengths * of the records is set in the array of iov structures */ if ((fd = rfio_open (argv[1], O_RDONLY)) < 0) { rfio_perror ("rfio_open"); errflg++; break; } for (j = 0; j < NBRECORDS_TOREAD; j++) { /* compute record offset */ iov[j].iov_base = 0; for (i = 0; i < records_toread[j]; i++) iov[j].iov_base = (char *) iov[j].iov_base + lengths[i]; /* set length */ iov[j].iov_len = lengths[records_toread[j]]; } if (rfio_preseek (fd, iov, iovnb) < 0) { rfio_perror ("rfio_preseek"); errflg++; break; } /* Read back the records and check their cpntents */ for (j = 0; j < NBRECORDS_TOREAD; j++) { if (rfio_lseek (fd, (off_t) iov[j].iov_base, SEEK_SET) < 0) { rfio_perror ("rfio_lseek"); errflg++; break; } if (rfio_read (fd, buf, iov[j].iov_len) < 0) { rfio_perror ("rfio_read"); errflg++; break; } for (i = 0; i < iov[j].iov_len; i++) { if (buf[i] != records_toread[j]) { fprintf (stderr, "incorrect data read, record %d\\n", records_toread[j]); errflg++; break; } } if (errflg) break; } (void) rfio_close (fd); break; } if (rfio_unlink (argv[1]) < 0) { rfio_perror ("rfio_unlink"); errflg++; } #if defined(_WIN32) WSACleanup(); #endif exit (errflg ? 1 : 0); } .ft .fi .SH RETURN VALUE This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EBADF .I s is not a valid descriptor. .TP .B EINVAL RFIO_READOPT is not set to RFIO_READBUF. .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SETIMEDOUT Timed out. .TP .B SEBADVERSION Version ID mismatch. .TP .B SECONNDROP Connection closed by remote end. .TP .B SECOMERR Communication error. .TP .B SENORCODE Host did not return error number. .SH SEE ALSO .BR rfio_lseek(3) , .BR rfio_open(3) , .BR rfio_read(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/pread.c0000644000175000017500000000466310222773541014431 0ustar ellertellert/* * $Id: pread.c,v 1.1 2005/03/31 13:13:01 baud Exp $ */ /* * Copyright (C) 1993-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: pread.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:01 $ CERN/IT/PDP/DM Felix Hassine"; #endif /* not lint */ /* pread.c Remote command I/O - read from a popened command */ #define RFIO_KERNEL 1 /* KERNEL part of the routines */ #include "rfio.h" /* Remote File I/O general definitions */ #include "rfio_rfilefdt.h" int DLL_DECL rfio_pread(ptr, size, items, fp) /* Remote file read */ char *ptr; /* buffer pointer */ int size, items; /* .. size items */ RFILE *fp; /* remote file pointer */ { int status ; int rcode; char *p ; char buf[256]; /* General input/output buffer */ INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_pread(%x, %d, %d, %x)", ptr, size, items, fp); if (rfio_rfilefdt_findptr(fp,FINDRFILE_WITH_SCAN) == -1) { TRACE(3,"rfio","local pread(%x,%d,%d,%x)",ptr, size, items, &(fp->fp)); status = fread(ptr, size, items, fp->fp_save) ; END_TRACE(); rfio_errno = 0; if ( status > 0) ptr[status]= '\0' ; else serrno = 0; return status ; } p = buf ; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_FREAD); marshall_LONG(p, size); marshall_LONG(p, items); TRACE(3, "rfio", "rfio_pread: sending %d bytes", 2*WORDSIZE+2*LONGSIZE); if (netwrite_timeout(fp->s, buf, RQSTSIZE, RFIO_CTRL_TIMEOUT) != RQSTSIZE ) { TRACE(2, "rfio", "rfio_pread: write(): ERROR occured (errno=%d)", errno); END_TRACE(); return -1 ; } p = buf; TRACE(3, "rfio", "rfio_pread: reading %d bytes", 2*LONGSIZE); if (netread_timeout(fp->s, buf, 2*LONGSIZE, -1) != (2*LONGSIZE)) { TRACE(2, "rfio", "rfio_pread: read(): ERROR occured (errno=%d)", errno); END_TRACE(); return -1 ; } unmarshall_LONG(p, status); unmarshall_LONG(p, rcode); rfio_errno = rcode ; TRACE(1, "rfio", "rfio_pread: status %d, rfio_errno %d", status, rfio_errno); if ( status > 0 ) { TRACE(2, "rfio", "rfio_pread: reading %d bytes", status*size); if (netread_timeout(fp->s, ptr, status*size, RFIO_DATA_TIMEOUT) != (status*size)) { TRACE(2, "rfio", "rfio_pread: read(): ERROR occured (errno=%d)", errno); END_TRACE(); return -1 ; } } END_TRACE(); return(status); } lcgdm-1.10.0/rfio/rfio_closedir.man0000644000175000017500000000240310222773541016500 0ustar ellertellert.\" .\" $Id: rfio_closedir.man,v 1.1 2005/03/31 13:13:02 baud Exp $ .\" .\" @(#)$RCSfile: rfio_closedir.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:02 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2001 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_CLOSEDIR 3 "$Date: 2005/03/31 13:13:02 $" CASTOR "Rfio Library Functions" .SH NAME rfio_closedir \- close directory opened by .B rfio_opendir .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_closedir (RDIR *" dirp ");" .SH DESCRIPTION .B rfio_closedir closes the directory opened by .B rfio_opendir and associated with the .B RDIR structure pointed by .IR dirp . .TP .I dirp specifies the pointer value returned by .BR rfio_opendir . .SH RETURN VALUE This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EBADF File descriptor in DIR structure is invalid. .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SETIMEDOUT Timed out. .TP .B SEBADVERSION Version ID mismatch. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR rfio_opendir(3) , .BR rfio_readdir(3) , .BR rfio_rewinddir(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_fchmod.man0000644000175000017500000000021310222773541016131 0ustar ellertellert.so ./rfio_chmod.man .\" @(#)$RCSfile: rfio_fchmod.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:02 $ CERN IT-DS/HSM Jean-Philippe Baud lcgdm-1.10.0/rfio/msymlink.c0000644000175000017500000002742410222773541015201 0ustar ellertellert/* * $Id: msymlink.c,v 1.1 2005/03/31 13:13:01 baud Exp $ */ /* * Copyright (C) 1995-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: msymlink.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:01 $ CERN/IT/PDP/DM Jean-Damien Durand"; #endif /* not lint */ #include #include "Cmutex.h" #include "Castor_limits.h" #include #include "log.h" #define RFIO_KERNEL 1 #include "rfio.h" #include #include #include typedef struct socks { char host[CA_MAXHOSTNAMELEN+1]; int s ; int Tid; } msymlink_connects ; static msymlink_connects msymlink_tab[MAXMCON]; /* UP TO MAXMCON connections simultaneously */ static int rfio_smsymlink _PROTO((int, char *, char *)); static int rfio_msymlink_allocentry _PROTO((char *, int, int)); static int rfio_msymlink_findentry _PROTO((char *,int)); static int rfio_symend_this _PROTO((int,int)); extern int rfio_newhost _PROTO((char *)); int DLL_DECL rfio_msymlink(n1,file2) char *n1 ; char *file2 ; { int rt ,rc ,fd, rfindex, Tid, parserc; char *host , *filename ; INIT_TRACE("RFIO_TRACE"); Cglobals_getTid(&Tid); TRACE(1, "rfio", "rfio_msymlink(\"%s\",\"%s\"), Tid=%d", n1, file2, Tid); if (!(parserc = rfio_parseln(file2,&host,&filename,NORDLINKS))) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file */ rfio_errno = 0; serrno = SEOPNOTSUP; rc = -1; END_TRACE(); return(rc); } /* The file is local */ #if ! defined(_WIN32) rc = symlink(n1,filename) ; if ( rc < 0 ) serrno = 0; #else { serrno = SEOPNOTSUP; rc = -1;} #endif rfio_errno = 0; END_TRACE(); return (rc) ; } else { if (parserc < 0) { END_TRACE(); return(-1); } /* Look if already in */ serrno = 0; rfindex = rfio_msymlink_findentry(host,Tid); TRACE(2, "rfio", "rfio_msymlink: rfio_msymlink_findentry(host=%s,Tid=%d) returns %d", host, Tid, rfindex); if (rfindex >= 0) { rc = rfio_smsymlink(msymlink_tab[rfindex].s,n1,filename) ; END_TRACE(); return ( rc) ; } rc = 0; fd=rfio_connect(host,&rt) ; if ( fd < 0 ) { END_TRACE(); return (-1) ; } rfindex = rfio_msymlink_allocentry(host,Tid,fd); TRACE(2, "rfio", "rfio_msymlink: rfio_msymlink_allocentry(host=%s,Tid=%d,s=%d) returns %d", host, Tid, fd, rfindex); serrno = 0; if ( rfindex >= 0 ) { rc = rfio_smsymlink(fd,n1,filename); } else { rc = rfio_smsymlink(fd,n1,filename) ; TRACE(2,"rfio","rfio_msymlink() overflow connect table, host=%s, Tid=%d. Closing %d",host,Tid,fd); netclose(fd); } } END_TRACE(); return (rc) ; } static int pw_key = -1; static int old_uid_key = -1; static int rfio_smsymlink(s,n1,filename) int s ; char * n1 ; char * filename ; { char buf[BUFSIZ]; int status; /* remote fopen() status */ int len; int rc, ans_req, rcode; char *p=buf; int uid; int gid; int *old_uid = NULL; struct passwd *pw_tmp; struct passwd *pw = NULL; char *nbuf ; TRACE(3, "rfio", "rfio_smsymlink(%s)", filename); if ( Cglobals_get(&old_uid_key, (void**)&old_uid, sizeof(int)) > 0 ) *old_uid = -1; Cglobals_get(&pw_key, (void**)&pw, sizeof(struct passwd)); len = strlen(filename)+1; uid = geteuid() ; gid = getegid () ; if ( uid != *old_uid ) { pw_tmp = Cgetpwuid(uid); if( pw_tmp == NULL ) { TRACE(3, "rfio" ,"rfio_smsymlink: Cgetpwuid(): ERROR occured (errno=%d)",errno); rfio_symend_this(s,1); return(-1); } memcpy(pw, pw_tmp, sizeof(struct passwd)); *old_uid = uid; } marshall_WORD(p, B_RFIO_MAGIC); marshall_WORD(p, RQST_MSYMLINK); status = strlen(pw->pw_name)+strlen(n1)+strlen(filename)+3+2*WORDSIZE; marshall_LONG(p, status) ; if ( status > BUFSIZ ) { TRACE(3,"rfio","rfio_smsymlink: request too long %d (max %d)",status,BUFSIZ); END_TRACE(); rfio_symend_this(s,0); serrno = E2BIG; return(-1); } if (netwrite_timeout(s,buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(3, "rfio", "smsymlink: write(): ERROR occured (errno=%d)", errno); rfio_symend_this(s,0); return(-1); } nbuf = (char *) malloc( status ) ; if ( nbuf == NULL ) { TRACE(3, "rfio", "smsymlink: malloc () failed"); rfio_symend_this(s,1); return(-1); } p = nbuf ; marshall_WORD(p,uid) ; marshall_WORD(p,gid) ; marshall_STRING( p, n1 ) ; marshall_STRING( p, filename ) ; marshall_STRING( p, pw->pw_name) ; if (netwrite_timeout(s,nbuf,status,RFIO_CTRL_TIMEOUT) != status ) { TRACE(3, "rfio", "smsymlink: write(): ERROR occured (errno=%d)",errno); rfio_symend_this(s,0); free(nbuf) ; return(-1); } free(nbuf) ; /* * Getting back status */ if ((rc = netread_timeout(s, buf, WORDSIZE + 2*LONGSIZE, RFIO_CTRL_TIMEOUT)) != (WORDSIZE+ 2*LONGSIZE)) { TRACE(3, "rfio", "rfio_smsymlink: read(): ERROR occured (errno=%d)", errno); rfio_symend_this(s, (rc <= 0 ? 0 : 1)); return(-1); } p = buf; unmarshall_WORD( p, ans_req ); unmarshall_LONG( p, status ) ; unmarshall_LONG( p, rcode ) ; if ( ans_req != RQST_MSYMLINK ) { TRACE(3,"rfio","rfio_smsymlink: ERROR: answer does not correspond to request !"); rfio_symend_this(s,1); return(-1); } TRACE(3,"rfio","rfio_smsymlink: return %d",rcode); rfio_errno = rcode ; if ( status < 0 ) { return(-1); } return(0) ; } int DLL_DECL rfio_symend() { int i,Tid, j=0 ; char buf[RQSTSIZE]; char *p=buf ; int rc = 0; INIT_TRACE("RFIO_TRACE"); Cglobals_getTid(&Tid); TRACE(3,"rfio","rfio_symend entered, Tid=%d", Tid); TRACE(3,"rfio","rfio_symend: Lock msymlink_tab"); if (Cmutex_lock((void *) msymlink_tab,-1) != 0) { TRACE(3,"rfio","rfio_symend: Cmutex_lock(msymlink_tab,-1) error No %d (%s)", errno, strerror(errno)); END_TRACE(); return(-1); } for (i = 0; i < MAXMCON; i++) { if (msymlink_tab[i].Tid == Tid) { if ((msymlink_tab[i].s >= 0) && (msymlink_tab[i].host[0] != '\0')) { marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_END); marshall_LONG(p, j); TRACE(3,"rfio","rfio_symend: close(msymlink_tab[%d].s=%d), host=%s, Tid=%d",i,msymlink_tab[i].s, msymlink_tab[i].host, Tid); if (netwrite_timeout(msymlink_tab[i].s,buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(3, "rfio", "rfio_symend: write(): ERROR occured (errno=%d), Tid=%d", errno, Tid); rc = -1; } netclose(msymlink_tab[i].s); } msymlink_tab[i].s = -1; msymlink_tab[i].host[0] = '\0'; msymlink_tab[i].Tid = -1; } } TRACE(3,"rfio","rfio_symend: Unlock msymlink_tab"); if (Cmutex_unlock((void *) msymlink_tab) != 0) { TRACE(3,"rfio","rfio_symend: Cmutex_unlock(msymlink_tab) error No %d (%s)", errno, strerror(errno)); rc = -1; } END_TRACE(); return(rc); } /* This is a simplified version of rfio_symend() that just free entry in the table */ /* If flag is set a clean close (write on the socket) is tried */ static int rfio_symend_this(s,flag) int s; int flag; { int i,Tid, j=0 ; char buf[RQSTSIZE]; char *p=buf ; int rc = 0; Cglobals_getTid(&Tid); TRACE(3,"rfio","rfio_symend_this(s=%d,flag=%d) entered, Tid=%d", s, flag, Tid); TRACE(3,"rfio","rfio_symend_this: Lock msymlink_tab"); if (Cmutex_lock((void *) msymlink_tab,-1) != 0) { TRACE(3,"rfio","rfio_symend_this: Cmutex_lock(msymlink_tab,-1) error No %d (%s)", errno, strerror(errno)); return(-1); } for (i = 0; i < MAXMCON; i++) { if (msymlink_tab[i].Tid == Tid) { if ((msymlink_tab[i].s == s) && (msymlink_tab[i].host[0] != '\0')) { if (flag) { marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_END); marshall_LONG(p, j); TRACE(3,"rfio","rfio_symend_this: close(msymlink_tab[%d].s=%d), host=%s, Tid=%d",i,msymlink_tab[i].s, msymlink_tab[i].host, Tid); if (netwrite_timeout(msymlink_tab[i].s,buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(3, "rfio", "rfio_symend_this: netwrite_timeout(): ERROR occured (errno=%d), Tid=%d", errno, Tid); } } netclose(msymlink_tab[i].s); msymlink_tab[i].s = -1; msymlink_tab[i].host[0] = '\0'; msymlink_tab[i].Tid = -1; } } } TRACE(3,"rfio","rfio_symend_this: Unlock msymlink_tab"); if (Cmutex_unlock((void *) msymlink_tab) != 0) { TRACE(3,"rfio","rfio_symend_this: Cmutex_unlock(msymlink_tab) error No %d (%s)", errno, strerror(errno)); rc = -1; } return(rc); } /* * Seach for a free index in the msymlink_tab table */ static int rfio_msymlink_allocentry(hostname,Tid,s) char *hostname; int Tid; int s; { int i; int rc; TRACE(3,"rfio","rfio_msymlink_allocentry: Lock msymlink_tab"); if (Cmutex_lock((void *) msymlink_tab,-1) != 0) { TRACE(3,"rfio","rfio_msymlink_allocentry: Cmutex_lock(msymlink_tab,-1) error No %d (%s)", errno, strerror(errno)); return(-1); } /* Scan it */ for (i = 0; i < MAXMCON; i++) { if (msymlink_tab[i].host[0] == '\0') { rc = i; strncpy(msymlink_tab[i].host,hostname,CA_MAXHOSTNAMELEN); msymlink_tab[i].host[CA_MAXHOSTNAMELEN] = '\0'; msymlink_tab[i].Tid = Tid; msymlink_tab[i].s = s; goto _rfio_msymlink_allocentry_return; } } serrno = ENOENT; rc = -1; _rfio_msymlink_allocentry_return: TRACE(3,"rfio","rfio_msymlink_allocentry: Unlock msymlink_tab"); if (Cmutex_unlock((void *) msymlink_tab) != 0) { TRACE(3,"rfio","rfio_msymlink_allocentry: Cmutex_unlock(msymlink_tab) error No %d (%s)", errno, strerror(errno)); return(-1); } return(rc); } /* * Seach for a given index in the msymlink_tab table */ static int rfio_msymlink_findentry(hostname,Tid) char *hostname; int Tid; { int i; int rc; TRACE(3,"rfio","rfio_msymlink_findentry: Lock msymlink_tab"); if (Cmutex_lock((void *) msymlink_tab,-1) != 0) { TRACE(3,"rfio","rfio_msymlink_findentry: Cmutex_lock(msymlink_tab,-1) error No %d (%s)", errno, strerror(errno)); return(-1); } /* Scan it */ for (i = 0; i < MAXMCON; i++) { if ((strcmp(msymlink_tab[i].host,hostname) == 0) && (msymlink_tab[i].Tid == Tid)) { rc = i; /* Lie to rfio_lasthost() */ rfio_newhost(hostname); goto _rfio_msymlink_findentry_return; } } serrno = ENOENT; rc = -1; _rfio_msymlink_findentry_return: TRACE(3,"rfio","rfio_msymlink_findentry: Unlock msymlink_tab"); if (Cmutex_unlock((void *) msymlink_tab) != 0) { TRACE(3,"rfio","rfio_msymlink_findentry: Cmutex_unlock(msymlink_tab) error No %d (%s)", errno, strerror(errno)); return(-1); } return(rc); } int DLL_DECL rfio_msymlink_reset() { int i,Tid; int rc = 0; INIT_TRACE("RFIO_TRACE"); Cglobals_getTid(&Tid); TRACE(3,"rfio","rfio_msymlink_reset entered, Tid=%d", Tid); TRACE(3,"rfio","rfio_msymlink_reset: Lock msymlink_tab"); if (Cmutex_lock((void *) msymlink_tab,-1) != 0) { TRACE(3,"rfio","rfio_msymlink_reset: Cmutex_lock(msymlink_tab,-1) error No %d (%s)", errno, strerror(errno)); END_TRACE(); return(-1); } for (i = 0; i < MAXMCON; i++) { if ((msymlink_tab[i].s >= 0) && (msymlink_tab[i].host[0] != '\0')) { TRACE(3,"rfio","rfio_msymlink_reset: Resetting socket fd=%d, host=%s\n", msymlink_tab[i].s, msymlink_tab[i].host); netclose(msymlink_tab[i].s); } msymlink_tab[i].s = -1; msymlink_tab[i].host[0] = '\0'; msymlink_tab[i].Tid = -1; } TRACE(3,"rfio","rfio_msymlink_reset: Unlock msymlink_tab"); if (Cmutex_unlock((void *) msymlink_tab) != 0) { TRACE(3,"rfio","rfio_msymlink_reset: Cmutex_unlock(msymlink_tab) error No %d (%s)", errno, strerror(errno)); rc = -1; } END_TRACE(); return(rc); } lcgdm-1.10.0/rfio/fread.c0000644000175000017500000000445511540401120014377 0ustar ellertellert/* * $Id: fread.c 4203 2011-03-17 12:45:04Z baud $ */ /* * Copyright (C) 1990-2011 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: fread.c,v $ $Revision: 4203 $ $Date: 2011-03-17 13:45:04 +0100 (Thu, 17 Mar 2011) $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy"; #endif /* not lint */ /* fread.c Remote File I/O - write a binary file */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rfilefdt.h" #include /* * Remote file read */ int DLL_DECL rfio_fread(ptr, size, items, fp) void *ptr; /* buffer pointer */ int size, items; /* .. size items */ RFILE *fp; /* remote file pointer */ { int rc ; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_fread(%x, %d, %d, %x)", ptr, size, items, fp); /* * Checking fp validity */ if ( fp == NULL ) { errno = EBADF ; TRACE(2,"rfio","rfio_fread() : FILE ptr is NULL ") ; END_TRACE() ; return 0 ; } if (rfio_rfilefdt_findptr(fp,FINDRFILE_WITH_SCAN) == -1) { TRACE(2,"rfio","rfio_fread() : using local fread() ") ; rfio_errno = 0; rc= fread(ptr, size, items, (FILE *)fp) ; if ( rc == 0 ) serrno = 0; END_TRACE() ; return rc ; } TRACE(2,"rfio","rfio_fread() : ------------>2") ; /* * Checking magic number */ if ( fp->magic != RFIO_MAGIC) { int fps = fp->s; serrno = SEBADVERSION ; TRACE(2,"rfio","rfio_fread() : Bad magic number ") ; free((char *)fp); (void) close(fps) ; END_TRACE(); return 0 ; } /* * The file is remote */ rc= rfio_read(fp->s,ptr,size*items) ; switch(rc) { case -1: #ifdef linux ((RFILE *)fp)->eof |= _IO_ERR_SEEN ; #else #if defined( __APPLE__) ((RFILE *)fp)->eof |= __SERR ; #else #ifdef __Lynx__ ((RFILE *)fp)->eof |= _ERR ; #else ((RFILE *)fp)->eof |= _IOERR ; #endif #endif #endif rc= 0 ; break ; case 0: #ifdef linux ((RFILE *)fp)->eof |= _IO_EOF_SEEN ; #else #if defined( __APPLE__) ((RFILE *)fp)->eof |= __SEOF ; #else #ifdef __Lynx__ ((RFILE *)fp)->eof |= _EOF ; #else ((RFILE *)fp)->eof |= _IOEOF ; #endif #endif #endif break ; default: rc= rc/size ; break ; } END_TRACE() ; return rc ; } lcgdm-1.10.0/rfio/rfcp.c0000644000175000017500000003746312700422460014266 0ustar ellertellert/* * $Id: rfcp.c 12230 2016-04-04 08:26:24Z furano $ */ /* * Copyright (C) 1994-2010 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rfcp.c,v $ $Revision: 12230 $ $Date: 2016-04-04 10:26:24 +0200 (Mon, 04 Apr 2016) $ CERN/IT/DS/HSM Felix Hassine, Olof Barring, Jean-Damien Durand"; #endif /* not lint */ #include #include #define RFIO_KERNEL 1 #include #include #include #include #include #include #include #include #include #include #ifndef _WIN32 #include #endif #include #ifndef TRANSFER_UNIT #define TRANSFER_UNIT 131072 #endif #define SYERR 2 #define USERR 1 #define OK 0 extern int serrno ; extern int rfio_errno ; extern char *getconfent() ; #if sgi extern char *strdup _PROTO((CONST char *)); #endif void usage(); off64_t copyfile _PROTO((int, int, char *, u_signed64)); #ifdef CNS_ROOT void copyfile_stgcleanup _PROTO((int)); #endif /* CNS_ROOT */ int have_maxsize; u_signed64 maxsize; int v2 = 0; u_signed64 inpfile_size = 0; #ifndef _WIN32 /* Signal handler - Simplify the POSIX sigaction calls */ #ifdef __STDC__ typedef void Sigfunc(int); Sigfunc *_rfio_signal(int, Sigfunc *); #else typedef void Sigfunc(); Sigfunc *_rfio_signal(); #endif #else #define _rfio_signal(a,b) signal(a,b) #endif int main(argc, argv) int argc; char *argv[]; { int argvindx; /* argument index in program argv */ #if defined(_WIN32) int binmode = O_BINARY; #else int binmode = 0; #endif int c; int cfargc; /* number of arguments in command file */ char **cfargv; /* arguments in command file */ int cfargvindx; /* argument index in command file */ char *curargv; /* current argv */ int fd1, fd2; int incmdfile = 0; /* 1 = processing command file */ struct stat64 sbuf, sbuf2; off64_t size; time_t starttime, endtime; int rc ; int rc2 ; char filename[BUFSIZ], filename_sav[BUFSIZ], inpfile[BUFSIZ], outfile[BUFSIZ] ; char *cp , *ifce ; char ifce1[16] ; char ifce2[16] ; char *host1, *host2, *path1, *path2 ; char shost1[32]; int l1, l2 ; int v; extern char * getifnam() ; #if defined(_WIN32) WSADATA wsadata; #endif int input_is_local = 1; have_maxsize = -1; maxsize = 0; cfargc = 0; cfargvindx = 0; inpfile[0] = '\0'; outfile[0] = '\0'; memset(&sbuf,'\0',sizeof(sbuf)); memset(&sbuf2,'\0',sizeof(sbuf2)); for (argvindx = 1; argvindx < argc || cfargvindx < cfargc; ) { if (cfargvindx >= cfargc) { incmdfile = 0; } curargv = incmdfile ? cfargv[cfargvindx++] : argv[argvindx++]; #if defined(_WIN32) if (strcmp (curargv, "-a") == 0) { binmode = O_TEXT; continue; } else if (strcmp (curargv, "-b") == 0) { binmode = O_BINARY; continue; } else if (*curargv == '@') { if ((cfargc = cmdf2argv (curargv+1, &cfargv)) < 0) { exit (USERR); } if (cfargc == 0) { continue; } incmdfile = 1; cfargvindx = 0; continue; } #endif if (strcmp (curargv, "-s") == 0) { if (argvindx >= argc && cfargvindx >= cfargc) { usage(); } if (cfargvindx >= cfargc) { incmdfile = 0; } curargv = incmdfile ? cfargv[cfargvindx++] : argv[argvindx++]; /* We verify that curargv do not contain other characters but digits */ if (strspn(curargv,"0123456789") != strlen(curargv)) { fprintf(stderr,"-s option value should contain only digits\n"); exit(USERR); } maxsize = strtou64(curargv); if (maxsize == 0) { usage(); } have_maxsize = 1; continue; } else if (strcmp(curargv, "-v2") == 0) { if (v2) { usage(); /* Option yet parsed */ } v2 = 1; continue; } /* Special treatment for filenames starting with /scratch/... */ if (inpfile[0] == '\0') { if (!strncmp ("/scratch/", curargv, 9) && (cp = getconfent ("SHIFT", "SCRATCH", 0)) != NULL) { strcpy (inpfile, cp); strcat (inpfile, curargv+9); } else strcpy (inpfile, curargv); } else { if (!strncmp ("/scratch/", curargv, 9) && (cp = getconfent ("SHIFT", "SCRATCH", 0)) != NULL) { strcpy (outfile, cp); strcat (outfile, curargv+9); } else strcpy (outfile, curargv); } } if (! outfile[0]) { usage(); } /* Check that files are not identical ! */ #if defined(_WIN32) if (WSAStartup (MAKEWORD (2, 0), &wsadata)) { fprintf (stderr, "WSAStartup unsuccessful\n"); exit (SYERR); } #endif if ( rfio_stat64( outfile, &sbuf2) == 0 && S_ISDIR(sbuf2.st_mode) ) { /* Not allowed if inpfile is stdin */ if (strcmp(inpfile,"-") == 0) { fprintf (stderr, "Not valid output when input is the stdin\n"); exit (USERR); } if ( (cp = strrchr(inpfile,'/')) != NULL ) { cp++; } else { cp = inpfile; } sprintf(filename, "%s/%s", outfile, cp); } else { strcpy(filename,outfile); } strcpy(filename_sav,filename); l1 = rfio_parseln( inpfile , &host1, &path1, NORDLINKS ) ; if (l1 < 0) { fprintf(stderr,"%s\n",sstrerror(serrno)); exit (USERR); } if ( l1 ) { strcpy(shost1,host1) ; input_is_local = 0; } strcpy( filename, path1 ); l2 = rfio_parseln( filename_sav , &host2, &path2, NORDLINKS ) ; if (l2 < 0) { fprintf(stderr,"%s\n",sstrerror(serrno)); exit(USERR); } /* Command is of the form cp f1 f2. */ serrno = rfio_errno = 0; if (strcmp(inpfile,"-") != 0) { rc = rfio_stat64(inpfile, &sbuf); if ( rc == 0 && ( S_ISDIR(sbuf.st_mode) || S_ISCHR(sbuf.st_mode) #if !defined(_WIN32) || S_ISBLK(sbuf.st_mode) #endif ) ) { fprintf(stderr,"file %s: Not a regular file\n",inpfile); #if defined(_WIN32) WSACleanup(); #endif exit(USERR) ; } else if (rc == 0) { inpfile_size = (u_signed64) sbuf.st_size; } else { rfio_perror(inpfile); #if defined(_WIN32) WSACleanup(); #endif exit(USERR) ; } } else { sbuf.st_mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH; /* Default open mode */ } strcpy(filename,filename_sav); if ( ( l1 == 0 && l2 == 0 && (!memcmp(&sbuf,&sbuf2,sizeof(sbuf))) ) || ( l1 && l2 && !strcmp( shost1, host2 ) && (!memcmp(&sbuf,&sbuf2,sizeof(sbuf))) ) ) { fprintf(stderr,"files are identical \n"); #if defined(_WIN32) WSACleanup(); #endif exit (USERR) ; } /* Activate new transfer mode for source file */ if (! v2) { v = RFIO_STREAM; rfiosetopt(RFIO_READOPT,&v,4); } serrno = rfio_errno = 0; #ifdef CNS_ROOT if (rfio_HsmIf_IsHsmFile(inpfile)) { /* The input is a CASTOR file - we need a signal handler because rfio_open() calls the stager */ #if ! defined(_WIN32) _rfio_signal (SIGHUP, copyfile_stgcleanup); _rfio_signal (SIGQUIT, copyfile_stgcleanup); #endif _rfio_signal (SIGINT, copyfile_stgcleanup); _rfio_signal (SIGTERM, copyfile_stgcleanup); } if (rfio_HsmIf_IsHsmFile(inpfile) && (have_maxsize > 0) && (inpfile_size > 0)) { /* User specified a CASTOR file in input with a limited size in bytes */ /* We cannot use rfio_open() directly because then the stager will try to */ /* stage the full file */ serrno = rfio_errno = 0; fd1 = rfio_HsmIf_open_limbysz(inpfile,O_RDONLY|binmode ,0644, (maxsize < inpfile_size) ? maxsize : inpfile_size, 1); } else { #endif /* CNS_ROOT */ serrno = rfio_errno = 0; if (strcmp(inpfile,"-") == 0) { fd1 = fileno(stdin); } else { fd1 = rfio_open64(inpfile,O_RDONLY|binmode ,0644); } #ifdef CNS_ROOT } #endif /* CNS_ROOT */ if (fd1 < 0) { if (serrno) { rfio_perror(inpfile); #ifdef CNS_ROOT c = (serrno == EACCES || serrno == EINVAL || serrno == ENOENT) ? USERR : SYERR; #else c = SYERR; #endif } else { switch (rfio_errno) { case EACCES: case EISDIR: case ENOENT: case EPERM : rfio_perror(inpfile); c = USERR; break ; case ENOSPC : rfio_perror(inpfile); c = ENOSPC; break ; case EBUSY : rfio_perror(inpfile); c = EBUSY; break ; case 0: switch(errno) { case EACCES: case EISDIR: case ENOENT: case EPERM : rfio_perror(inpfile); c = USERR; break; case ENOSPC : rfio_perror(inpfile); c = ENOSPC; break; case EBUSY : rfio_perror(inpfile); c = EBUSY; break; default: rfio_perror(inpfile); c = SYERR; } break; default: rfio_perror(inpfile); c = SYERR; } } #if defined(_WIN32) WSACleanup(); #endif exit (c); } if ( (ifce=getifnam(fd1))==NULL ) { strcpy(ifce1,"local"); } else { strcpy(ifce1,ifce); } /* Activate new transfer mode for target file */ if (! v2) { v = RFIO_STREAM; rfiosetopt(RFIO_READOPT,&v,4); } serrno = rfio_errno = 0; fd2 = rfio_open64(filename , O_WRONLY|O_CREAT|O_TRUNC|binmode ,sbuf.st_mode & 0777); if (fd2 < 0) { if (serrno) { rfio_perror(outfile); #ifdef CNS_ROOT c = (serrno == EACCES || serrno == EINVAL || serrno == ENOENT) ? USERR : SYERR; #else c = SYERR; #endif } else { switch (rfio_errno) { case EACCES: case EISDIR: case ENOENT: case EPERM : rfio_perror(outfile); c = USERR; break; case ENOSPC : rfio_perror(outfile); c = ENOSPC; break; case EBUSY : rfio_perror(outfile); c = EBUSY; break; case 0: switch(errno) { case EACCES: case EISDIR: case ENOENT: case EPERM : rfio_perror(outfile); c = USERR; break; case ENOSPC : rfio_perror(outfile); c = ENOSPC; break; case EBUSY : rfio_perror(outfile); c = EBUSY; break; default: rfio_perror(outfile); c = SYERR; } break; default: rfio_perror(outfile); c = SYERR; } } #if defined(_WIN32) WSACleanup(); #endif exit (c); } /* * Get interfaces names */ if ( (ifce=getifnam(fd2))==NULL ) { strcpy(ifce2,"local"); } else { strcpy(ifce2,ifce); } time(&starttime); size = copyfile(fd1, fd2, outfile, maxsize); if ( rfio_HsmIf_GetHsmType(fd1,NULL) == RFIO_HSM_CNS ) { if (rfio_close(fd1) < 0) { rfio_perror("close source"); #if defined(_WIN32) WSACleanup(); #endif exit(SYERR); } } if ( rfio_HsmIf_GetHsmType(fd2,NULL) == RFIO_HSM_CNS ) { if (rfio_close(fd2) < 0) { struct stat64 sbuf; mode_t mode; rfio_perror("close target"); rfio_stat64(outfile, &sbuf); /* check for special files */ mode = sbuf.st_mode & S_IFMT; if (mode == S_IFREG) { rfio_unlink(filename); } #if defined(_WIN32) WSACleanup(); #endif exit(SYERR); } } time(&endtime); if (size>0) { char tmpbuf[21]; char tmpbuf2[21]; fprintf(stdout,"%s bytes in %d seconds through %s (in) and %s (out)", u64tostr(size, tmpbuf, 0), (int) (endtime-starttime),ifce1,ifce2); l1 = endtime-starttime ; if ( l1 > 0) { fprintf(stdout," (%d KB/sec)\n",(int) (size/(1024*l1)) ); } else { fprintf(stdout,"\n"); } if (have_maxsize < 0) { rc2 = (inpfile_size == size ? OK : ((strcmp(inpfile,"-") == 0) ? OK : SYERR)); if (rc2 == SYERR) { #ifdef _WIN32 if (binmode != O_BINARY) { fprintf(stderr,"%s : got %s bytes instead of %s bytes\n", "Warning", u64tostr(size, tmpbuf, 0), u64tostr(inpfile_size, tmpbuf2, 0)); rc = OK; } else { #endif fprintf(stderr,"%s : got %s bytes instead of %s bytes\n", sstrerror(SESYSERR), u64tostr(size, tmpbuf, 0), u64tostr(inpfile_size, tmpbuf2, 0)); #ifdef _WIN32 } #endif } } else { if (maxsize < inpfile_size) { /* If input is "-", inpfile_size is zero */ rc2 = (maxsize == size ? OK : SYERR); if (rc2 == SYERR) { #ifdef _WIN32 if (binmode != O_BINARY) { fprintf(stderr,"%s : got %s bytes instead of %s bytes\n", "Warning", u64tostr(size, tmpbuf, 0), u64tostr(maxsize, tmpbuf2, 0)); rc = OK; } else { #endif fprintf(stderr,"%s : got %s bytes instead of %s bytes\n", sstrerror(SESYSERR), u64tostr(size, tmpbuf, 0), u64tostr(maxsize, tmpbuf2, 0)); #ifdef _WIN32 } #endif } } else { rc2 = (inpfile_size == size ? OK : ((strcmp(inpfile,"-") == 0) ? OK : SYERR)); if (rc2 == SYERR) { #ifdef _WIN32 if (binmode != O_BINARY) { fprintf(stderr,"%s : got %s bytes instead of %s bytes\n", "Warning", u64tostr(size, tmpbuf, 0), u64tostr(inpfile_size, tmpbuf2, 0)); rc = OK; } else { #endif fprintf(stderr,"%s : got %s bytes instead of %s bytes\n", sstrerror(SESYSERR), u64tostr(size, tmpbuf, 0), u64tostr(inpfile_size, tmpbuf2, 0)); #ifdef _WIN32 } #endif } } } } else if (size < 0) { rc2 = SYERR; } else { char tmpbuf[21]; fprintf(stdout,"%s bytes transferred !!\n",u64tostr(size, tmpbuf, 0)); rc2 = (inpfile_size == 0 ? OK : SYERR); } #if defined(_WIN32) WSACleanup(); #endif exit(rc2); } off64_t copyfile(fd1, fd2, name, maxsize) int fd1, fd2; u_signed64 maxsize; char *name; { int n; mode_t mode; int m = -1; struct stat64 sbuf; off64_t effsize=0; char *p; int bufsize = TRANSFER_UNIT; char * cpbuf; extern char *getenv(); /* External declaration */ u_signed64 total_bytes = 0; if ((p=getenv("RFCPBUFSIZ")) == NULL) { if ((p=getconfent("RFCP","BUFFERSIZE",0)) == NULL) { bufsize=TRANSFER_UNIT; } else { bufsize=atoi(p); } } else { bufsize=atoi(p); } if (bufsize<=0) bufsize=TRANSFER_UNIT; if ( ( cpbuf = malloc(bufsize) ) == NULL ) { perror("malloc"); #if defined(_WIN32) WSACleanup(); #endif exit (SYERR); } do { if (have_maxsize != -1) { if ((maxsize - total_bytes) < bufsize) bufsize = maxsize - total_bytes; } serrno = rfio_errno = 0; n = rfio_read(fd1, cpbuf, bufsize); if (n > 0) { int count = 0; total_bytes += n; effsize += n; serrno = rfio_errno = 0; while (count != n && (m = rfio_write(fd2, cpbuf+count, n-count)) > 0) { count += m; } if (m < 0) { int save_err = rfio_serrno(); /* Write failed. Don't keep truncated regular file. */ rfio_perror("rfcp"); if ( rfio_HsmIf_GetHsmType(fd2,NULL) != RFIO_HSM_CNS ) { if (rfio_close(fd2) < 0) { rfio_perror("close target"); } } rfio_stat64(name, &sbuf); /* check for special files */ mode = sbuf.st_mode & S_IFMT; if (mode == S_IFREG) rfio_unlink(name); #if defined(_WIN32) WSACleanup(); #endif free(cpbuf); exit((save_err == ENOSPC) ? ENOSPC : ((serrno == EBUSY) ? EBUSY : SYERR)); } } else { if (n < 0) { rfio_perror("cp: read error"); break; } } } while ((total_bytes != maxsize) && (n > 0)); serrno = rfio_errno = 0; if (rfio_HsmIf_GetHsmType(fd1,NULL) != RFIO_HSM_CNS && rfio_close(fd1) < 0) { rfio_perror("close source"); #if defined(_WIN32) WSACleanup(); #endif free(cpbuf); exit(SYERR); } serrno = rfio_errno = 0; if (rfio_HsmIf_GetHsmType(fd2,NULL) != RFIO_HSM_CNS && rfio_close(fd2) < 0) { rfio_perror("close target"); rfio_stat64(name, &sbuf); /* check for special files */ mode = sbuf.st_mode & S_IFMT; if (mode == S_IFREG) { rfio_unlink(name); } #if defined(_WIN32) WSACleanup(); #endif free(cpbuf); exit(SYERR); } free(cpbuf); return(effsize); } void usage() { fprintf(stderr,"Usage: rfcp [-s maxsize] [-v2] f1 f2; or rfcp f1 \n"); exit(USERR); } #ifdef CNS_ROOT void copyfile_stgcleanup(sig) int sig; { TRACE(2,"rfio","copyfile_stgcleanup: Received signal No %d", sig); } #endif /* CNS_ROOT */ #ifndef _WIN32 Sigfunc *_rfio_signal(signo, func) int signo; Sigfunc *func; { struct sigaction act, oact; int n = 0; act.sa_handler = func; sigemptyset(&act.sa_mask); act.sa_flags = 0; if (signo == SIGALRM) { #ifdef SA_INTERRUPT act.sa_flags |= SA_INTERRUPT; /* SunOS 4.x */ #endif } else { #ifdef SA_RESTART act.sa_flags |= SA_RESTART; /* SVR4, 44BSD */ #endif } n = sigaction(signo, &act, &oact); if (n < 0) { return(SIG_ERR); } switch (signo) { #if ! defined(_WIN32) case SIGHUP: TRACE(2,"rfio","_rfio_signal: Trapping SIGHUP"); break; case SIGQUIT: TRACE(2,"rfio","_rfio_signal: Trapping SIGQUIT"); break; #endif case SIGINT: TRACE(2,"rfio","_rfio_signal: Trapping SIGINT"); break; case SIGTERM: TRACE(2,"rfio","_rfio_signal: Trapping SIGTERM"); break; default: TRACE(2,"rfio","_rfio_signal: Trapping signal No %d", signo); break; } return(oact.sa_handler); } #endif /* #ifndef _WIN32 */ lcgdm-1.10.0/rfio/chown.c0000644000175000017500000000574210222773541014453 0ustar ellertellert/* * $Id: chown.c,v 1.1 2005/03/31 13:13:00 baud Exp $ */ /* * Copyright (C) 1994-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: chown.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:00 $ CERN/IT/PDP/DM Felix Hassine"; #endif /* not lint */ /* chown.c Remote File I/O - Change a file owner */ #define RFIO_KERNEL 1 /* KERNEL part of the routines */ #include "rfio.h" /* Remote File I/O general definitions */ int DLL_DECL rfio_chown(file, owner, group) /* Remote chown */ char *file; /* remote file path */ int owner ; /* Owner's uid */ int group ; /* Owner's gid */ { char buf[BUFSIZ]; /* General input/output buffer */ register int s; /* socket descriptor */ int status; /* remote chown() status */ int len; char *host, *filename; char *p=buf; int rt ; int rcode, parserc ; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_chown(%s, %d, %d)", file,owner,group); if (!(parserc = rfio_parseln(file,&host,&filename,NORDLINKS))) { if ( host != NULL ) { /* * HSM file */ TRACE(1,"rfio","rfio_chown: %s is an HSM path", filename); END_TRACE(); rfio_errno = 0; return(rfio_HsmIf_chown(filename,owner,group)); } TRACE(1, "rfio", "rfio_chown: using local chown(%s, %d, %d)", filename, owner, group); END_TRACE(); rfio_errno = 0; status = chown(filename,owner, group); if ( status < 0 ) serrno = 0; return(status); } if (parserc < 0) { END_TRACE(); return(-1); } s = rfio_connect(host,&rt); if (s < 0) { END_TRACE(); return(-1); } len = strlen(filename)+ 2* WORDSIZE + 1; if ( RQSTSIZE+len > BUFSIZ ) { TRACE(2,"rfio","rfio_chown: request too long %d (max %d)", RQSTSIZE+len,BUFSIZ); END_TRACE(); (void) netclose(s); serrno = E2BIG; return(-1); } marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_CHOWN); marshall_WORD(p, geteuid()); marshall_WORD(p, getegid()); marshall_LONG(p, len); p= buf + RQSTSIZE; marshall_STRING(p, filename); marshall_WORD(p, owner) ; marshall_WORD(p, group); TRACE(2,"rfio","rfio_chown: sending %d bytes",RQSTSIZE+len) ; if (netwrite_timeout(s,buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { TRACE(2, "rfio", "rfio_chown: write(): ERROR occured (errno=%d)", errno); (void) netclose(s); END_TRACE(); return(-1); } p = buf; TRACE(2, "rfio", "rfio_chown: reading %d bytes", LONGSIZE); if (netread_timeout(s, buf, 2* LONGSIZE, RFIO_CTRL_TIMEOUT) != (2 * LONGSIZE)) { TRACE(2, "rfio", "rfio_chown: read(): ERROR occured (errno=%d)", errno); (void) netclose(s); END_TRACE(); return(-1); } unmarshall_LONG(p, status); unmarshall_LONG(p, rcode); TRACE(1, "rfio", "rfio_chown: return %d",status); rfio_errno = rcode; (void) netclose(s); if (status) { END_TRACE(); return(-1); } END_TRACE(); return (0); } lcgdm-1.10.0/rfio/rfio_chmod.man0000644000175000017500000000551710222773541015777 0ustar ellertellert.\" .\" $Id: rfio_chmod.man,v 1.1 2005/03/31 13:13:02 baud Exp $ .\" .\" @(#)$RCSfile: rfio_chmod.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:02 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2003 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_CHMOD 3 "$Date: 2005/03/31 13:13:02 $" CASTOR "Rfio Library Functions" .SH NAME rfio_chmod, rfio_fchmod \- change access mode of a directory/file .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_chmod (const char *" path ", mode_t " mode ");" .br .BI "int rfio_fchmod (int " s ", mode_t " mode ");" .SH DESCRIPTION .B rfio_chmod sets the access permission portion of the mode of a directory/file to the bit pattern in .IR mode. .LP .B rfio_fchmod is identical to .B rfio_chmod but works on the file descriptor .I s returned by .BR rfio_open . .TP .I path specifies the logical pathname relative to the current directory or the full pathname. .TP .I mode is constructed by OR'ing the bits defined in .RB < sys/stat.h > under Unix or \fB "statbits.h"\fR under Windows/NT: .sp .RS .B S_IRUSR 0000400 read by owner .br .B S_IWUSR 0000200 write by owner .br .B S_IXUSR 0000100 execute/search by owner .br .B S_IRGRP 0000040 read by group .br .B S_IWGRP 0000020 write by group .br .B S_IXGRP 0000010 execute/search by group .br .B S_IROTH 0000004 read by others .br .B S_IWOTH 0000002 write by others .br .B S_IXOTH 0000001 execute/search by others .RE .sp The effective user ID of the process must match the owner of the file or be super-user. If a directory is writable and has the sticky bit set, files/directories within that directory can be removed or renamed only if: .RS .LP the effective user ID of the requestor matches the owner ID of the file or .LP the effective user ID of the requestor matches the owner ID of the directory or .LP the file is writable by the requestor or .LP the requestor is super-user. .RE .SH RETURN VALUE This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EPERM The effective user ID does not match the owner of the file and is not super-user. .TP .B ENOENT The named file/directory does not exist or is a null pathname. .TP .B EBADF .I s is not a valid file descriptor. .TP .B EACCES Search permission is denied on a component of the .I path prefix or write permission on the file itself is denied. .TP .B EFAULT .I path is a NULL pointer. .TP .B ENOTDIR A component of .I path prefix is not a directory. .TP .B ENAMETOOLONG The length of .I path exceeds .B CA_MAXPATHLEN or the length of a .I path component exceeds .BR CA_MAXNAMELEN . .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR Castor_limits(4) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/write.c0000644000175000017500000001601010222773541014455 0ustar ellertellert/* * $Id: write.c,v 1.1 2005/03/31 13:13:04 baud Exp $ */ /* * Copyright (C) 1990-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: write.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:04 $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy, F. Hassine"; #endif /* not lint */ /* write.c Remote File I/O - write a file */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rfilefdt.h" #include /* malloc prototype */ /* * Remote file write */ int DLL_DECL rfio_write(s, ptr, size) void *ptr; int s, size; { int s_index; /* Remote file ? */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) != -1) { if (rfilefdt[s_index]->version3 == 1) { /* New V3 stream protocol for sequential transfers */ return(rfio_write_v3(s,(char *)ptr,size)); } else return(rfio_write_v2(s,(char *)ptr,size)); } else return(rfio_write_v2(s,(char *)ptr,size)); } int rfio_write_v2(s, ptr, size) char *ptr; int s, size; { int status ; /* Return code of called func */ int HsmType, save_errno, written_to; char * p ; /* Pointer to buffer */ char * trp ; /* Pointer to a temp buffer */ int temp=0 ; /* Has it been allocated ? */ char rfio_buf[BUFSIZ]; int s_index; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_write(%d, %x, %d)", s, ptr, size) ; #if defined (CLIENTLOG) /* Client logging */ rfio_logwr(s,size); #endif /* * Check HSM type and if file has been written to. The CASTOR HSM * uses normal RFIO (local or remote) to perform the I/O. Thus we * don't call rfio_HsmIf_write(). */ HsmType = rfio_HsmIf_GetHsmType(s,&written_to); if ( HsmType > 0 ) { if ( written_to == 0 && (status = rfio_HsmIf_FirstWrite(s,ptr,size)) < 0) { END_TRACE(); return(status); } if ( HsmType != RFIO_HSM_CNS ) { status = rfio_HsmIf_write(s,ptr,size); if ( status == -1 ) rfio_HsmIf_IOError(s,errno); END_TRACE(); return(status); } } /* * The file is local. */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1) { TRACE(2, "rfio", "rfio_write: using local write(%d, %x, %d)", s, ptr, size); status = write(s, ptr, size); if ( status < 0 ) serrno = 0; if ( HsmType == RFIO_HSM_CNS ) { save_errno = errno; rfio_HsmIf_IOError(s,errno); errno = save_errno; } END_TRACE(); rfio_errno = 0; return(status); } /* * Checking magic number. */ if (rfilefdt[s_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(s_index); (void) close(s) ; END_TRACE(); return(-1); } /* * Checking mode 64. */ if (rfilefdt[s_index]->mode64) { status = rfio_write64_v2(s, ptr, size); END_TRACE(); return(status); } /* * Repositionning file mark if needed. */ if ( (rfilefdt[s_index]->readissued || rfilefdt[s_index]->preseek) && rfilefdt[s_index]->lseekhow == -1 ) { rfilefdt[s_index]->lseekhow= SEEK_SET ; rfilefdt[s_index]->lseekoff= rfilefdt[s_index]->offset ; } /* * Resetting flags */ rfilefdt[s_index]->eof= 0 ; rfilefdt[s_index]->preseek= 0 ; rfilefdt[s_index]->nbrecord= 0 ; rfilefdt[s_index]->readissued= 0 ; if ( rfilefdt[s_index]->_iobuf.base ) { rfilefdt[s_index]->_iobuf.count= 0 ; rfilefdt[s_index]->_iobuf.ptr= iodata(rfilefdt[s_index]) ; } /* * Sending request. */ p= rfio_buf ; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_WRITE); marshall_LONG(p, size); marshall_LONG(p, rfilefdt[s_index]->lseekhow) ; marshall_LONG(p, rfilefdt[s_index]->lseekoff) ; rfilefdt[s_index]->lseekhow= -1 ; TRACE(2, "rfio", "rfio_write: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(s, rfio_buf, RQSTSIZE, RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2,"rfio","rfio_write: write(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } if (rfilefdt[s_index]->bufsize < size) { rfilefdt[s_index]->bufsize = size ; TRACE(2, "rfio", "rfio_write: setsockopt(SOL_SOCKET, SO_SNDBUF): %d", rfilefdt[s_index]->bufsize) ; if (setsockopt(s,SOL_SOCKET,SO_SNDBUF,(char *)&(rfilefdt[s_index]->bufsize),sizeof((rfilefdt[s_index]->bufsize))) == -1) { TRACE(2, "rfio" ,"rfio_write: setsockopt(SO_SNDBUF)") ; } } TRACE(2,"rfio","rfio_write: sending %d bytes",size) ; if (netwrite_timeout(s, ptr, size, RFIO_DATA_TIMEOUT) != size) { TRACE(2,"rfio","rfio_write: write(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } /* * Getting request answer. */ for(;;) { WORD req ; LONG rcode ; LONG msgsiz ; TRACE(2, "rfio", "rfio_write: reading %d bytes",rfilefdt[s_index]->_iobuf.hsize) ; if (netread_timeout(s,rfio_buf,rfilefdt[s_index]->_iobuf.hsize,RFIO_CTRL_TIMEOUT) != rfilefdt[s_index]->_iobuf.hsize) { TRACE(2, "rfio", "rfio_write: read(): ERROR occured (errno=%d)", errno); if ( temp ) (void) free(trp) ; END_TRACE() ; return -1 ; } p = rfio_buf ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p,rcode) ; unmarshall_LONG(p,msgsiz) ; switch(req) { case RQST_WRITE: rfio_errno = rcode; if ( status < 0 ) rfio_HsmIf_IOError(s,rfio_errno); if ( status < 0 && rcode == 0 ) serrno = SENORCODE ; if (status > 0 && rfilefdt[s_index]->offset + status < 0) { status = -1; serrno = EFBIG; } rfilefdt[s_index]->offset += status ; TRACE(1,"rfio","rfio_write: status %d, rcode %d",status,rcode) ; if ( temp ) (void) free(trp) ; END_TRACE() ; return status ; case RQST_READAHEAD: case RQST_LASTSEEK: case RQST_PRESEEK: /* * At this point, a temporary buffer may need to be created to * receive data which is going to be thrown away. */ if ( temp == 0 ) { if ( rfilefdt[s_index]->_iobuf.base==NULL || rfilefdt[s_index]->_iobuf.dsize and \fBDPM\fP Team lcgdm-1.10.0/rfio/rewinddir.c0000644000175000017500000000555710222773541015330 0ustar ellertellert/* * $Id: rewinddir.c,v 1.1 2005/03/31 13:13:01 baud Exp $ */ /* * Copyright (C) 1990-1999 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rewinddir.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:01 $ CERN/IT/PDP/DM Olof Barring"; #endif /* not lint */ /* rewinddir.c Remote File I/O - rewind a directory */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rdirfdt.h" /* * remote directory close */ int DLL_DECL rfio_rewinddir(dirp) RDIR *dirp; { WORD req ; LONG rcode ; LONG msgsiz ; int s; int status; char *p; extern RDIR *rdirfdt[MAXRFD]; char rfio_buf[BUFSIZ]; int s_index; /* * Search internal table for this directory pointer * Check first that it's not the last one used */ s_index = rfio_rdirfdt_findptr(dirp,FINDRDIR_WITH_SCAN); INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_rewinddir(0x%x)", dirp); /* * The directory is local */ if (s_index == -1) { TRACE(2, "rfio", "rfio_rewinddir: check if HSM directory"); if ( rfio_HsmIf_IsHsmDirEntry((DIR *)dirp) != -1 ) { (void)rfio_HsmIf_rewinddir((DIR *)dirp); } else { TRACE(2, "rfio", "rfio_rewinddir: using local rewinddir(0x%x)",dirp) ; #if defined(_WIN32) serrno = SEOPNOTSUP; return(-1); #else /* _WIN32 */ (void)rewinddir((DIR *)dirp) ; #endif /* _WIN32 */ } END_TRACE(); return(0) ; } s = rdirfdt[s_index]->s; /* * Checking magic number */ if ( rdirfdt[s_index]->magic != RFIO_MAGIC ) { serrno = SEBADVERSION ; rfio_rdirfdt_freeentry(s_index); (void) close(s) ; END_TRACE(); return(-1); } /* * Sending request. */ p= rfio_buf ; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_REWINDDIR); TRACE(2, "rfio", "rfio_rewinddir: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(s, rfio_buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio", "rfio_rewinddir: write(): ERROR occured (errno=%d)", errno); (void) rfio_dircleanup(s) ; END_TRACE() ; return -1 ; } /* * Getting data from the network. */ TRACE(2, "rfio", "rfio_rewinddir: reading %d bytes",WORDSIZE+3*LONGSIZE) ; if (netread_timeout(s,rfio_buf,WORDSIZE+3*LONGSIZE,RFIO_CTRL_TIMEOUT) != (WORDSIZE+3*LONGSIZE)) { TRACE(2, "rfio", "rfio_rewinddir: read(): ERROR occured (errno=%d)", errno); (void)rfio_dircleanup(s) ; END_TRACE() ; return -1 ; } p = rfio_buf ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; unmarshall_LONG(p,msgsiz) ; rfio_errno = rcode ; dirp->offset = 0; dirp->dp.dd_loc = 0; TRACE(1, "rfio", "rfio_rewinddir: return status=%d, rcode=%d",status,rcode) ; END_TRACE() ; return status ; } lcgdm-1.10.0/rfio/rfiod.scripts0000755000175000017500000001744712346545545015727 0ustar ellertellert#!/bin/sh # # rfiod Start/Stop rfiod. # # chkconfig: - 92 18 # description: RFIO server daemon # # $Id: rfiod.scripts 10627 2014-06-13 09:59:01Z dhsmith $ # # @(#)$RCSfile: rfiod.scripts,v $ $Revision: 10627 $ $Date: 2014-06-13 11:59:01 +0200 (Fri, 13 Jun 2014) $ CERN/IT/ADC/CA Jean-Damien Durand # PREFIX=/opt/lcg GRIDMAPDIR=/etc/grid-security/gridmapdir export GRIDMAPDIR if [ -d /opt/lcg/lib ] ; then LD_LIBRARY_PATH=/opt/lcg/lib:/opt/glite/lib:/opt/globus/lib export LD_LIBRARY_PATH fi CSEC_MECH=ID export CSEC_MECH CSEC_NOTHREAD=1 export CSEC_NOTHREAD RFIO_PORT_RANGE="20000 25000" export RFIO_PORT_RANGE RFIOLOGFILE=/var/log/rfio/log sysname=`uname -s` # source function library if [ -r /etc/rc.d/init.d/functions ]; then . /etc/rc.d/init.d/functions DAEMON=daemon FAILURE=failure ECHO_FAILURE=failure SUCCESS=success ECHO_SUCCESS=echo_success ECHO_END=echo if [ $sysname = "Linux" ]; then ECHOOPT=-n fi else DAEMON=eval FAILURE= ECHO_FAILURE= SUCCESS= ECHO_SUCCESS= ECHOOPT= ECHO_END= fi RETVAL=0 prog="rfiod" NOMORERFIO=/etc/operator/nomorerfio PIDFILE=/var/run/rfiod.pid PIDDIR=/var/run SUBSYS=/var/lock/subsys/rfiod SUBSYSDIR=/var/lock/subsys [ -z "$SILENTSTOP" ] && SILENTSTOP=0 RFIOD=$PREFIX/sbin/rfiod OPTIONS="-sl" if [ -r /etc/rfiod.conf ]; then SYSCONFIGRFIOD=/etc/rfiod.conf elif [ -r /etc/sysconfig/rfiod ]; then SYSCONFIGRFIOD=/etc/sysconfig/rfiod elif [ -r /etc/default/rfiod ]; then SYSCONFIGRFIOD=/etc/default/rfiod fi # ## Blindly attempt to create useful directories # # [ ! -d $PIDDIR ] && mkdir -p $PIDDIR > /dev/null 2>&1 # [ ! -d $SUBSYSDIR ] && mkdir -p $SUBSYSDIR > /dev/null 2>&1 if [ $sysname = "HP-UX" ]; then export UNIX95=1 fi if [ $sysname = "SunOS" ]; then format4comm="fname" elif [ $sysname = "Darwin" ]; then format4comm="ucomm" else format4comm="comm" fi case "$1" in start) echo $ECHOOPT "Starting $prog: " if [ -f ${NOMORERFIO} ]; then echo $ECHOOPT "${NOMORERFIO} exists: " [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "${NOMORERFIO} exists: " RETVAL=0 else if [ $sysname = "Linux" -a `whoami` = "root" ]; then netstat -ap | egrep '\*:5001|\*:rfio' | grep LISTEN | grep rfiod > /dev/null else netstat -a | egrep '\*[:.]5001|\*[:.]rfio' | egrep 'LISTEN *$' > /dev/null fi # ps -eo ppid,$format4comm | egrep '^[ \t]+1 rfiod' > /dev/null if [ $? -eq 0 ]; then echo $ECHOOPT "rfiod already started: " [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "rfiod already started: " RETVAL=0 else if [ -n "$SYSCONFIGRFIOD" ]; then # ## Source the configuration # . $SYSCONFIGRFIOD export DPNS_HOST export DPM_HOST if [ "${RUN_RFIOD}" != "yes" ]; then echo $ECHOOPT "$SYSCONFIGRFIOD says NO: " [ -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "$SYSCONFIGRFIOD says NO: " RETVAL=0 $ECHO_END exit $RETVAL fi if [ -n "${ULIMIT_N}" ]; then ulimit -n ${ULIMIT_N} fi fi if [ $RETVAL -eq 0 ]; then cd / mkdir -p `dirname $RFIOLOGFILE` chown dpmmgr:dpmmgr `dirname $RFIOLOGFILE` touch $RFIOLOGFILE chown -f dpmmgr:dpmmgr $RFIOLOGFILE X509_USER_CERT=/etc/grid-security/dpmmgr/dpmcert.pem export X509_USER_CERT X509_USER_KEY=/etc/grid-security/dpmmgr/dpmkey.pem export X509_USER_KEY $DAEMON "su dpmmgr -c \"$RFIOD $OPTIONS -f $RFIOLOGFILE\"" if [ $? -eq 0 ]; then [ -d $SUBSYSDIR ] && touch $SUBSYS if [ -d $PIDDIR ]; then pid=`ps -eo pid,ppid,$format4comm | grep " 1 rfiod$" | awk '{print $1}'` # The point of $PIDFILE is that it kills only # the master daemon. rm -f $PIDFILE echo $pid > $PIDFILE fi RETVAL=0 else echo $ECHOOPT "rfiod not started: " [ -n "$FAILURE" ] && $FAILURE "rfiod not started: " RETVAL=1 fi fi fi fi $ECHO_END ;; stop) if [ -f $PIDFILE ]; then [ $SILENTSTOP -eq 0 ] && echo $ECHOOPT "Stopping $prog: " # ## We just attempt to kill the main daemon ## Remaining child are allowed to continue transfer up to ## the end # if [ $SILENTSTOP -eq 0 ]; then kill -9 `cat $PIDFILE` else kill -9 `cat $PIDFILE` > /dev/null 2>&1 fi RETVAL=$? if [ $RETVAL -eq 0 ]; then rm -f $PIDFILE fi else # rfio might have been started by hand pid=`ps -eo pid,ppid,$format4comm | grep " 1 rfiod$" | awk '{print $1}'` if [ -n "$pid" ]; then [ $SILENTSTOP -eq 0 ] && echo $ECHOOPT "Stopping $prog: " # ## We just attempt to kill the main daemon ## Remaining child are allowed to continue transfer up to ## the end # if [ $SILENTSTOP -eq 0 ]; then kill -9 $pid else kill -9 $pid > /dev/null 2>&1 fi RETVAL=$? else [ $SILENTSTOP -eq 0 ] && echo $ECHOOPT "rfiod already stopped: " [ $SILENTSTOP -eq 0 -a -n "$ECHO_SUCCESS" ] && $ECHO_SUCCESS "rfiod already stopped: " RETVAL=0 fi fi if [ $SILENTSTOP -eq 0 -a $sysname = "Linux" ]; then if [ $RETVAL -eq 0 ]; then $ECHO_SUCCESS else $ECHO_FAILURE fi fi [ -d $SUBSYSDIR ] && rm -f $SUBSYS [ $SILENTSTOP -eq 0 -a -n "$ECHO_END" ] && $ECHO_END # ## Basically: if SILENTSTOP is not 0 when we never print something ## But if the stop is successful... One might want to see stop: OK ## anyway ? # if [ $SILENTSTOP -ne 0 -a $RETVAL -eq 0 ]; then echo $ECHOOPT "Stopping $prog: " [ $sysname = "Linux" ] && $ECHO_SUCCESS [ -n "$ECHO_END" ] && $ECHO_END fi ;; restart | force-reload) $0 stop if [ $? -eq 0 -o $SILENTSTOP -eq 0 ]; then $0 start RETVAL=$? else # ## It is legal to return zero it if was ## a conditional restart # if [ $SILENTSTOP -eq 0 ]; then RETVAL=1 else RETVAL=0 fi fi ;; condrestart | try-restart) SILENTSTOP=1 export SILENTSTOP $0 restart RETVAL=$? ;; reload) ;; status) pid=`ps -eo pid,ppid,$format4comm | grep " 1 rfiod$" | awk '{print $1}'` if [ -n "$pid" ]; then echo $ECHOOPT "rfiod (pid $pid) is running..." $ECHO_SUCCESS $ECHO_END RETVAL=0 else if [ -f $PIDFILE ]; then pid=`head -1 $PIDFILE` if [ "$pid" != "" ] ; then echo $ECHOOPT "rfiod dead but pid file exists" $ECHO_FAILURE $ECHO_END RETVAL=1 fi else if [ -f $SUBSYS ]; then echo $ECHOOPT "rfiod dead but subsys ($SUBSYS) locked" RETVAL=2 else echo $ECHOOPT "rfiod is stopped" RETVAL=3 fi $ECHO_FAILURE $ECHO_END fi fi ;; *) echo "Usage: $0 {start|stop|status|restart|condrestart}" RETVAL=1 ;; esac exit $RETVAL lcgdm-1.10.0/rfio/rfio_fileno.man0000644000175000017500000000175610222773541016162 0ustar ellertellert.\" .\" $Id: rfio_fileno.man,v 1.1 2005/03/31 13:13:02 baud Exp $ .\" .\" @(#)$RCSfile: rfio_fileno.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:02 $ CERN IT-DS/HSM Jean-Philippe Baud .\" Copyright (C) 2002 by CERN/IT/DS/HSM .\" All rights reserved .\" .TH RFIO_FILENO 3 "$Date: 2005/03/31 13:13:02 $" CASTOR "Rfio Library Functions" .SH NAME rfio_fileno \- maps stream pointer to file descriptor .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_fileno (FILE *" fp ");" .SH DESCRIPTION .B rfio_fileno returns the integer file descriptor associated with the stream pointed to by .IR fp . .SH RETURN VALUE Upon successful completion, .B rfio_fileno() returns the integer value of the file descriptor associated with the stream parameter. Otherwise, the value -1 is returned and .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EBADF .I fp is not a valid file descriptor. .SH SEE ALSO .BR rfio_fopen(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfrename.man0000644000175000017500000000201710222773541015455 0ustar ellertellert.\" .\" $Id: rfrename.man,v 1.1 2005/03/31 13:13:04 baud Exp $ .\" .\" @(#)$RCSfile: rfrename.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:04 $ CERN IT-PDP/DM Olof Barring .\" Copyright (C) 1998 by CERN/IT/PDP .\" All rights reserved .\" .TH RFRENAME 1 "$Date: 2005/03/31 13:13:04 $" CASTOR "Rfio User Commands" .SH NAME rfrename \- rename remote file .SH SYNOPSIS .B rfrename .IR filename1 .IR filename2 .SH DESCRIPTION .IX "\fLrfrename\fR" .B rfrename provides an interface to the .B shift remote file I/O daemon (rfiod) for renaming a remote file. The .IR filename argument is either a remote file name of the form: .IP .IB hostname : path .LP or a local file name (not containing the :/ character combination). .SH "SEE ALSO" .BR rename(2), .BR rfiod(1) .SH "NOTES" .B rfrename can only be used to rename files on the same remote system. It cannot be used to move files from one host to another. Use the .BR (rfcp(1)) program for copying files between different remote hosts. .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_open.man0000644000175000017500000000767610222773541015656 0ustar ellertellert.\" .\" $Id: rfio_open.man,v 1.1 2005/03/31 13:13:03 baud Exp $ .\" .\" @(#)$RCSfile: rfio_open.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2002 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_OPEN 3 "$Date: 2005/03/31 13:13:03 $" CASTOR "Rfio Library Functions" .SH NAME rfio_open \- opens a file .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_open (const char *" path ", int " flags ", int " mode ");" .br .sp Under Linux, for large files: .br .B #define _LARGEFILE64_SOURCE .br .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_open64 (const char *" path ", int " flags ", int " mode ");" .sp For large files, under other systems: .br .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_open64 (const char *" path ", int " flags ", int " mode ");" .SH DESCRIPTION .B rfio_open opens the file whose name is the string pointed to by .BR path , a character string containing the filename specification, and associates a FILE stream with it. .br .BI flags are formed by ORing the following values: .ft CW .nf .sp O_RDONLY Open for reading only O_WRONLY Open for writing only O_RDWR Open for reading and writing O_NDELAY Do not block on open O_APPEND Append on each write O_CREAT Create file if it does not exist O_TRUNC Truncate size to 0 O_EXCL Error if create and file exists O_LARGEFILE When size can be superior to 2GB\-1. See NOTES .ft .LP .fi .br .BI mode specifies the permission bits to be set if the file is created. .P Opening a file with O_APPEND set causes each write on the file to be appended to the end. If O_TRUNC is specified and the file exists, the file is truncated to zero length. If O_EXCL is set with O_CREAT, then if the file already exists, the open returns an error. This can be used to implement a simple exclusive access locking mechanism. If O_EXCL is set and the last component of the pathname is a symbolic link, the open will succeed even if the symbolic link points to an existing name. If the O_NDELAY flag is specified and the open call would result in the process being blocked for some reason (for example waiting for a carrier on a dial-up line), the open returns immediately. The first time the process attempts to perform \IO\ on the open file, it will block (not currently implemented). On systems that support the Large Files, O_LARGEFILE in rfio_open allows files whose sizes cannot be represented in 31 bits to be opened. .SH RETURN VALUE If successful, returns a non-negative integer which may be used to refer to the file on subsequent \fBrfio_write\fP, \fBrfio_read\fP and \fBrfio_close\fP calls. On failure, \fBrfio_open\fP returns -1 and the error code is stored in serrno. .SH ERRORS .TP 1.3i .B ENOENT The named file/directory does not exist or is a null pathname. .TP .B EACCES Search permission is denied on a component of the .I path prefix. .TP .B EBUSY Device or resource busy. Happens if you try to open in write mode a CASTOR file that is in an active migration stream. .TP .B EFAULT .I path is a NULL pointer. .TP .B ENOTDIR A component of .I path prefix is not a directory. .TP .B ENAMETOOLONG The length of .I path exceeds .B CA_MAXPATHLEN or the length of a .I path component exceeds .BR CA_MAXNAMELEN . .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SECOMERR Communication error. .SH SEE ALSO .BR Castor_limits(4) , rfio_write(3) , rfio_read(3) , rfio_close(3) .SH NOTES On Irix, Tru64 and IA64 the 64 bit mode is the default one, open and open64 are identical. The .I flag O_LARGEFILE is accepted on Irix and IA64 (where it has no effect) but not on Tru64. On all other platforms, rfio_open with O_LARGEFILE is equivalent to a call to rfio_open64. .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/parse.c0000644000175000017500000002233411336205452014441 0ustar ellertellert/* * $Id: parse.c 3172 2010-02-15 08:51:54Z baud $ */ /* * Copyright (C) 1990-2010 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: parse.c,v $ $Revision: 3172 $ $Date: 2010-02-15 09:51:54 +0100 (Mon, 15 Feb 2010) $ CERN/IT/PDP/DM Frederic Hemmer"; #endif /* not lint */ /* parse.c Remote File I/O - parse file path */ #define RFIO_KERNEL 1 /* system part of Remote File I/O */ #if !defined(_WIN32) #include /* system dependent parameters */ #endif #include #include #include "rfio.h" /* remote file I/O definitions */ #include #include extern int Cdomainname (char *, int); extern char *getconfent(); static int name0_key = -1; static int name1_key = -1; static int buffer_key = -1; static int islocalhost(localhost, host) char *localhost; char *host; { char *cp1, *cp2; char localdomain[CA_MAXHOSTNAMELEN+1]; if (strcmp(localhost, host) == 0 || strcmp("localhost", host) == 0) return(1); cp1 = strchr(localhost, '.'); cp2 = strchr(host, '.'); if ((cp1 == NULL && cp2 == NULL) || (cp1 && cp2)) return(0); if (cp1) { if (strncmp(localhost, host, cp1-localhost) == 0 && strlen(host) == (cp1-localhost)) return(1); else return(0); } if (strncmp(localhost, host, cp2-host) || strlen(localhost) != (cp2-host)) return(0); if (Cdomainname(localdomain, sizeof(localdomain)) < 0) return(-1); if (strcmp(cp2+1, localdomain) == 0) return(1); return(0); } int DLL_DECL rfio_parseln(name, host, path, ln) /* parse name to host and path */ char *name; char **host; char **path; int ln ; /* solve links or not ? */ { char *cp1, *cp2, *cp3; char *dp; register int i; char localhost[CA_MAXHOSTNAMELEN+1]; int n = 0; char *name_0 = NULL; char *name_1 = NULL; char *buffer = NULL; /* To hold temporary strings */ char *cwd_server; /* Current CASTOR working directory server */ if ( name == NULL ) { serrno = EINVAL; return(-1); } /* check if it is a TURL */ if (strncmp (name, "rfio://", 7) == 0) { name += 7; if (*name != '/') { /* Hostname is present */ if ((cp1 = strchr (name, '/')) == NULL || (cp1 - name ) >= CA_MAXHOSTNAMELEN+6) { serrno = EINVAL; return (-1); } Cglobals_get (&name0_key, (void**)&name_0, CA_MAXHOSTNAMELEN+6); strncpy (name_0, name, cp1-name); *(name_0+(cp1-name)) = '\0'; cp2 = strrchr (name_0, ':'); /* checks for validy of port in the hostname * The port number is expect to follow a hostname or IP address * IPv4 [IPv4] [IPv6] */ if (cp2 && (strchr (name_0, ':')==cp2 || (cp2-name_0>4 && *(cp2-1) == ']'))) { /* There is a port number */ if (strtol (cp2+1, &dp, 10) < 0 || *dp != '\0') { serrno = EINVAL; return (-1); } } if (*(cp1+1) == '/') cp1++; *host = name_0; *path = cp1; return (1); } else { if (*(name+1) == '/') name++; } } /* * forms recognized: host: * //host/ * * where prefix is defined in /etc/shift.conf : * RFIO NFS_ROOT /..... */ if ( rfioreadopt(RFIO_CONNECTOPT) == RFIO_FORCELOCAL ) { TRACE (2,"rfio","rfio_parseln(): Forcing local calls"); *host = NULL; *path = name; return(0) ; } if (strlen(name) > CA_MAXPATHLEN) { /* Not enough space */ serrno = SENAMETOOLONG; return(-1); } if (gethostname(localhost, sizeof(localhost)) < 0) { return(-1); } Cglobals_get(&name1_key, (void**)&name_1, CA_MAXPATHLEN+1); Cglobals_get(&buffer_key, (void**)&buffer, CA_MAXPATHLEN+1); if (ln != NORDLINKS ) { int countln = 0 ; char buffer1[CA_MAXPATHLEN+1],buffer2[CA_MAXPATHLEN+1]; strcpy ( buffer1, name ); #if defined(FollowRtLinks) while ( (n= rfio_readlink(buffer1,buffer,CA_MAXPATHLEN+1)) > 0 && countln < 4 ) #else #if !defined(_WIN32) while ( (n= readlink(buffer1,buffer,CA_MAXPATHLEN+1)) > 0 && countln < 4 ) #else if (countln) /* i.e. never, because links are not impl. */ #endif #endif /* FollowRtLinks */ { /* save original filename */ if (strlen(buffer1) > CA_MAXPATHLEN) { /* Not enough space */ serrno = SENAMETOOLONG; return(-1); } strcpy(buffer2,buffer1); countln ++ ; buffer[n]='\0'; /* Is it a relative path ? */ if (buffer[0] != '/') { char *last_slash; /* Is the relative link of the form host:/path ? */ if (strstr(buffer,":/") != NULL) { /* Simply replace name */ strcpy(buffer1,buffer); } else { /* Host name is NOT like XXXX:/YYYYY */ if (strchr(buffer,'$') != NULL && (cp3 = (char *)strchr(buffer,':')) != NULL ) { /* This is a VMS syntax ! */ strcpy(buffer1,buffer); } if ((last_slash = strrchr(buffer1,'/')) == NULL) { /* Simply replace name */ strcpy(buffer1,buffer); } else { /* Concat basename of old name with new name */ strcpy(last_slash + 1,buffer); } } } else strcpy(buffer1, buffer); TRACE (3,"rfio","rfio_parseln(): %s converted to %s",buffer2,buffer1); } strcpy(name_1,buffer1); } else strcpy(name_1,name); if (((cp1 = (char *)strstr(name_1,":/")) == NULL) || (strchr(name_1,'/') < (cp1+1)) ){ /* Host name is NOT like XXXX:/YYYYY */ /* The other case: it contains ":/". So we a sure that a strchr() of character "/" will not */ /* return NULL - we then demand that there is no other "/" character before the one at cp1+1... */ cp1 = name_1; if ( strchr(name_1,'$') != NULL && (cp3=(char *)strchr(name_1,':')) != NULL ) { /* This is a VMS syntax ! */ *host= name_1 ; *path= cp3+1 ; cp3[0]='\0' ; return (1) ; } #if defined(CNS_ROOT) TRACE(3,"rfio","rfio_parseln() check %s against root %s", name_1,CNS_ROOT); if ( rfio_HsmIf_IsCnsFile(name_1) > 0 ) { cwd_server = rfio_HsmIf_GetCwdServer(); *host = NULL; *path = NULL; *buffer = '\0'; TRACE(3,"rfio","rfio_parseln() call Cns_selectsrvr(%s,0x%lx,0x%lx,0x%lx)", name_1,cwd_server,buffer,path); if ( Cns_selectsrvr(name_1,cwd_server,buffer,path) == -1 ) { TRACE(3,"rfio","rfio_parseln() Cns_selectsrvr(): %s", sstrerror(serrno)); *host = NULL; *path = name_1; return(-1); } *host = buffer; TRACE(3,"rfio","rfio_parseln() Cns_selectsrvr() returns host=%s, path=%s", *host,*path); return(0); } #endif /* CNS_ROOT */ { int sav_serrno = serrno; cp2 = getconfent("RFIO","NFS_ROOT", 0); #ifdef NFSROOT if (cp2 == NULL) { TRACE(3,"rfio","rfio_parseln() Using site-wide NFS ROOT \"%s\"", NFSROOT); cp2 = NFSROOT; /* Restore serrno */ serrno = sav_serrno; } #endif } if (cp2 == NULL) { *host = NULL; *path = name_1; serrno=0; /* reset error */ return(0); } /* compare the 2 strings */ for (i=0;i< (int)strlen(cp2);i++) { if (*(cp1+i) != *(cp2+i)) { *host = NULL; *path = name_1; return(0); } } cp1 += strlen(cp2); /* cp2 may be matching cp1 but being shorted */ if (*cp1 != '/') { *host = NULL; *path = name_1; return(0); } /* cp1 now points to rooted nfs_path_name */ /* next token must be the node name prefixed by '/' */ if ((cp2 = strchr(++cp1,'/')) == NULL) { /* incomplete name: /prefix/node */ *host = NULL; *path = name_1; return(0); } strncpy(buffer,cp1,(int)(cp2-cp1)); buffer[cp2-cp1] = '\0'; *host = buffer; *path = name_1; /* is it localhost ? */ if (islocalhost(localhost, buffer)) { *host = NULL; return(0); } else { return(1); } } else { char *cp4, *cp5; /* first check if the path is in DOS format, e.g. hostname:x:/path/name * hostname may also be an IP address of the form: * IPv4 [IPv4] [IPv6] * port specification is not handled */ cp2 = NULL; cp3 = NULL; cp4 = strchr(name_1, ':'); while(cp4 && cp4 /* * Remote file read */ int DLL_DECL rfio_getc(fp) RFILE *fp; /* remote file pointer */ { unsigned char c ; int rc ; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_getc(%x)", fp); /* * Checking fp validity */ if ( fp == NULL ) { errno = EBADF ; TRACE(2,"rfio","rfio_getc() : FILE ptr is NULL ") ; END_TRACE() ; return EOF ; } if (rfio_rfilefdt_findptr(fp,FINDRFILE_WITH_SCAN) == -1) { TRACE(2,"rfio","rfio_getc() : using local getc() ") ; rfio_errno = 0; rc= getc((FILE *)fp) ; if ( rc == EOF ) serrno = 0; END_TRACE() ; return rc ; } TRACE(2,"rfio","rfio_getc() : ------------>2") ; /* * Checking magic number */ if ( fp->magic != RFIO_MAGIC) { int fps = fp->s; serrno = SEBADVERSION ; TRACE(2,"rfio","rfio_getc() : Bad magic number ") ; free((char *)fp); (void) close(fps) ; END_TRACE(); return EOF ; } /* * The file is remote */ rc= rfio_read(fp->s,&c,1) ; switch(rc) { case -1: #ifdef linux ((RFILE *)fp)->eof |= _IO_ERR_SEEN ; #else #if defined( __APPLE__) ((RFILE *)fp)->eof |= __SERR ; #else #ifdef __Lynx__ ((RFILE *)fp)->eof |= _ERR ; #else ((RFILE *)fp)->eof |= _IOERR ; #endif #endif #endif rc= EOF ; break ; case 0: #ifdef linux ((RFILE *)fp)->eof |= _IO_EOF_SEEN ; #else #if defined( __APPLE__) ((RFILE *)fp)->eof |= __SEOF ; #else #ifdef __Lynx__ ((RFILE *)fp)->eof |= _EOF ; #else ((RFILE *)fp)->eof |= _IOEOF ; #endif #endif #endif rc= EOF ; break ; default: rc= (int) c ; break ; } END_TRACE() ; return rc ; } lcgdm-1.10.0/rfio/rfrm.c0000644000175000017500000001365311336205452014301 0ustar ellertellert/* * $Id: rfrm.c 3172 2010-02-15 08:51:54Z baud $ */ /* * Copyright (C) 1998-2010 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rfrm.c,v $ $Revision: 3172 $ $Date: 2010-02-15 09:51:54 +0100 (Mon, 15 Feb 2010) $ CERN/IT/PDP/DM Olof Barring"; #endif /* not lint */ /* * Remove remote file */ #include #include #include #include #include #include #include #if defined(_WIN32) #include #endif #define RFIO_KERNEL 1 #include struct dirstack { char *dir; struct dirstack *prev; }; static char *ckpath(); int force; char *getconfent(); static int rm_recursive(); char *cmd; main(argc, argv) int argc; char *argv[]; { int i, c, status; extern char * optarg ; extern int optind ; char *path,*root_path; int recursive = 0; int ask_yesno = 1; struct stat64 st; #if defined(_WIN32) WSADATA wsadata; #endif /* _WIN32 */ cmd = argv[0]; if ( argc < 2 ) { fprintf(stderr,"%s [-r] pathname ...\n",cmd); exit(1); } while ( (c = getopt(argc,argv,"fr")) != EOF ) { switch(c) { case 'f': force++; break; case 'r': recursive++; break; case '?': fprintf(stderr,"Usage: %s [-f] [-r] pathname ...\n",cmd); exit(2); } } #if defined(_WIN32) if (WSAStartup (MAKEWORD (2, 0), &wsadata)) { fprintf (stderr, "WSAStartup unsuccessful\n"); exit (2); } #endif for (;optindprev = *ds; tmp->dir = (char *)malloc((strlen(dir)+1)*sizeof(char)); strcpy(tmp->dir,dir); *ds = tmp; return(0); } static struct dirstack *rfio_popdir(ds) struct dirstack **ds; { struct dirstack *tmp; if ( ds == NULL ) return(NULL); tmp = *ds; *ds = (*ds)->prev; free(tmp->dir); free(tmp); return(*ds); } static int read_yesno() { int i, rc, retval; i =0; retval = 'n'; do { rc = fgetc(stdin); if ( rc == ' ' ) continue; if ( i == 0 ) { retval = rc; i++; } } while ( rc != EOF && rc != '\n'); return(retval); } static int rm_recursive(path, yesno) char *path; int *yesno; { DIR *dirp; struct dirent *de; struct stat64 st; char *p; struct dirstack *ds = NULL; int ask_yesno = 1; int empty = 1; if ( !rfio_lstat64(path,&st) ) { if ( S_ISDIR(st.st_mode) ) { if ( force == 0 && (yesno == NULL || *yesno) ) { printf("%s: descend into directory `%s'? ",cmd,path); if ( read_yesno() != 'y' ) return(-1); if ( yesno != NULL ) *yesno = 0; } dirp = (DIR *)rfio_opendir(path); while ( ( de = (struct dirent *)rfio_readdir((RDIR *)dirp) ) != NULL ) { if ( strcmp(de->d_name,".") && strcmp(de->d_name,"..") ) { empty = 0; p = (char *)malloc(strlen(path)+strlen(de->d_name)+2); strcpy(p,path); strcat(p,"/"); strcat(p,de->d_name); if ( rfio_lstat64(p,&st) == -1 ) { fprintf(stderr,"%s: %s\n",p,rfio_serror()); free(p); } else { if ( S_ISDIR(st.st_mode) ) { rfio_pushdir(&ds,p); } else { if ( rfio_unlink(p) ) { fprintf(stderr,"unlink(%s): %s\n",p,rfio_serror()); exit(1); } free(p); } } } } rfio_closedir((RDIR *)dirp); if ( empty ) { if ( force == 0 ) { printf("%s: remove directory `%s'? ",cmd,path); if ( read_yesno() != 'y' ) return(-1); } if ( rfio_rmdir(path) == -1 ) { fprintf(stderr,"rmdir(%s): %s\n",path,rfio_serror()); exit(2); } } } else { /* if ( S_ISDIR(st.st_mode) ) ... */ if ( rfio_unlink(path) ) { fprintf(stderr,"unlink(%s): %s\n",path,rfio_serror()); exit(1); } } while ( ds != NULL ) { while ( rm_recursive(ds->dir,&ask_yesno) == 0 ); rfio_popdir(&ds); } } else { /* if ( !rfio_lstat64(path,&st) ) .... */ return(-1); } return(0); } lcgdm-1.10.0/rfio/rfio_apiinit.c0000644000175000017500000000127710243372574016014 0ustar ellertellert/* * Copyright (C) 2005 by CERN/IT/GD/CT * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: rfio_apiinit.c,v $ $Revision: 1.1 $ $Date: 2005/05/20 14:34:36 $ CERN IT-GD/CT Jean-Philippe Baud"; #endif /* not lint */ /* rfio_apiinit - allocate thread specific or global structures */ #include #include #include #include "Cglobals.h" #include "rfio_api.h" #include "serrno.h" static int rfio_api_key = -1; int DLL_DECL rfio_apiinit(thip) struct rfio_api_thread_info **thip; { Cglobals_get (&rfio_api_key, (void **) thip, sizeof(struct rfio_api_thread_info)); if (*thip == NULL) { serrno = ENOMEM; return (-1); } return (0); } lcgdm-1.10.0/rfio/rfio_mstat64.man0000644000175000017500000000021310222773541016173 0ustar ellertellert.so ./rfio_stat.man .\" @(#)$RCSfile: rfio_mstat64.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:03 $ CERN IT-PDP/DM Jean-Philippe Baud lcgdm-1.10.0/rfio/lun2fn.c0000644000175000017500000000570410222773541014537 0ustar ellertellert/* * $Id: lun2fn.c,v 1.1 2005/03/31 13:13:01 baud Exp $ */ /* * Copyright (C) 1990-1999 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: lun2fn.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:01 $ CERN/IT/PDP/DM Frederic Hemmer"; #endif /* not lint */ /* lun2fn.c Remote File I/O - translate FORTRAN LUN to file name */ /* * C bindings : * * assign syntax : * * fort.LUN:[,[,...]] * * char *lun2fn(int lun) * */ #define RFIO_KERNEL 1 /* system part of Remote File I/O */ #include "rfio.h" /* remote file I/O definitions */ #include /* password entry structure */ #include extern char *getenv(); char * DLL_DECL lun2fn(lun) /* find file name corresponding to lun */ int lun; { char *afile; /* assign file name */ FILE *fp; /* a file pointer */ char *p, *p1; /* character pointers */ int clun; /* current lun entry */ static char buf[1024]; /* general purpose buffer */ /* * Open the assign file, get the corresponding entry */ INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "lun2fn: looking environment for %s", "RFASSIGN"); if ((p = getenv("RFASSIGN")) != NULL) { afile = p; } else { /* No RFASSIGN env var, so get the passwd entry */ TRACE(1, "rfio", "lun2fn: getting home directory name"); if ((p = Cgetpwuid(getuid())->pw_dir) == NULL) { END_TRACE(); return(NULL); } sprintf(buf,"%s/%s",p,DEFASNFNAM); afile = buf; } TRACE(1, "rfio", "lun2fn: opening %s", afile); if ((fp = fopen(afile, "r")) == NULL) { if (errno == ENOENT) { #if hpux sprintf (buf, "ftn%02d", lun); #else sprintf (buf, "fort.%d", lun); #endif TRACE(1, "rfio", "lun2fn: assigning unit %d to %s", lun, buf); END_TRACE(); return(buf); } else { END_TRACE(); return(NULL); } } for (;(p=fgets(buf, BUFSIZ, fp)) != NULL;) { p = strchr(p,'.'); p1 = strchr(p+1, ':'); *(p1++)='\0'; clun = atoi(p+1); TRACE(1, "rfio", "lun2fn: processing entry %d", clun); if (clun == lun) { /* matching entry */ p = p1; /* The string is terminated by \n, \0 or \, */ if ((p1 = strpbrk(p,"\n\0,")) != NULL) { *p1 = '\0'; } break; } else { p = NULL; } } (void) fclose(fp); if (p == NULL) { /* no matching entry */ #if hpux sprintf (buf, "ftn%d", lun); #else sprintf (buf, "fort.%d", lun); #endif TRACE(1, "rfio", "lun2fn: assigning unit %d to %s", lun, buf); END_TRACE(); return(buf); } else { TRACE(1, "rfio", "lun2fn: assigning unit %d to %s", lun, p); END_TRACE(); return(p); } } lcgdm-1.10.0/rfio/rfio_fopen.man0000644000175000017500000000467010222773541016013 0ustar ellertellert.\" .\" $Id: rfio_fopen.man,v 1.1 2005/03/31 13:13:02 baud Exp $ .\" .\" @(#)$RCSfile: rfio_fopen.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:02 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2000 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_FOPEN 3 "$Date: 2005/03/31 13:13:02 $" CASTOR "Rfio Library Functions" .SH NAME rfio_fopen \- opens a file .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "FILE *rfio_fopen (char *" path ", char *" mode ");" .br .sp Under Linux, for large files: .br .B #define _LARGEFILE64_SOURCE .br .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "FILE *rfio_fopen64 (char *" path ", char " *mode ");" .sp For large files, under other systems: .br .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "FILE *rfio_fopen64 (char *" path ", char " *mode ");" .SH DESCRIPTION .B rfio_fopen opens the file whose name is the string pointed to by .BI path , a character string containing the filename specification, and associates a FILE stream with it. .P .BI mode is an access mode indicator. One of the characters "r" or "w". .sp .B rfio_fopen64 allows to open large files (see NOTES). .SH RETURN VALUE This routine returns NULL if the operation failed or a non-NULL pointer to a FILE structure if the operation was successful. If it fails, \fBserrno\fP variable is set appropriately. .SH ERRORS .TP 1.3i .B ENOENT The named file/directory does not exist or is a null pathname. .TP .B EACCES Search permission is denied on a component of the .I path prefix. .TP .B EFAULT path is NULL .TP .B ENOTDIR A component of .I path prefix is not a directory. .TP .B EINVAL The mode provided to local open is invalid (see \fBfopen\fP(3)) .TP .B EMFILE Too many open files .TP .B ECONNRESET Connection reset by peer .TP .B ETIMEDOUT Connection timed out .TP .B ECONNREFUSED Connection refused .TP .B EHOSTUNREACH No route to host .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SEBADVERSION Version ID mismatch .TP .B SECOMERR Communication error. .TP .B SERTYEXHAUST Retry count exhausted .TP .B SENORCODE Host did not return error number .TP .B SEHOSTREFUSED Host is not on local network and no mapping found .SH NOTES On Irix, Tru64 and IA64 the 64 bit mode is the default one, rfio_fopen and rfio_fopen64 are identical. .SH SEE ALSO .BR fopen(3) , .BR rfio_serror(3) , .BR rfio_perror(3) , .BR serrno(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/rfio_rcp.man0000644000175000017500000000333511441363735015471 0ustar ellertellert.\" .\" $Id: rfio_rcp.man 3783 2010-09-07 07:21:01Z baud $ .\" .\" @(#)$RCSfile: rfio_rcp.man $ $Revision: 3783 $ $Date: 2010-09-07 09:21:01 +0200 (Tue, 07 Sep 2010) $ CERN IT-GT/DMS Jean-Philippe Baud .\" Copyright (C) 2009-2010 by CERN/IT/GT/DMS .\" All rights reserved .\" .TH RFIO_RCP 3 "$Date: 2010-09-07 09:21:01 +0200 (Tue, 07 Sep 2010) $" CASTOR "Rfio Library Functions" .SH NAME rfio_rcp \- third party copy of a file .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_rcp (char *" source ", char *" destination ", int " timeout ");" .SH DESCRIPTION .B rfio_rcp triggers a third party copy of a file. .TP .I source specifies the physical path of the source file. .TP .I destination specifies the physical path of the file at destination. .TP .I timeout specifies the time after which the copy is cancelled if not completed. .SH RETURN VALUE This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B ENOENT The source file does not exist or a component of .I destination prefix does not exist. .TP .B EACCES Search permission is denied on a component of the .I source or .I destination prefix or read permission is not granted on the source file or write permission on the destination parent directory is denied. .TP .B EFAULT .I source or .I destination is a NULL pointer. .TP .B ENOSPC No space to store the new file copy. .TP .B ENAMETOOLONG The length of .I source or .I destination exceeds .B CA_MAXPATHLEN or the length of a path component exceeds .BR CA_MAXNAMELEN . .TP .B SENOSHOST Host unknown. .TP .B SETIMEDOUT Has timed out. .TP .B SECOMERR Communication error. .SH SEE ALSO .B Castor_limits(4) lcgdm-1.10.0/rfio/rfio_write.man0000644000175000017500000000251110222773541016026 0ustar ellertellert.\" .\" $Id: rfio_write.man,v 1.1 2005/03/31 13:13:04 baud Exp $ .\" .\" @(#)$RCSfile: rfio_write.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:04 $ CERN IT-PDP/DM Jean-Philippe Baud .\" Copyright (C) 1999-2001 by CERN/IT/PDP/DM .\" All rights reserved .\" .TH RFIO_WRITE 3 "$Date: 2005/03/31 13:13:04 $" CASTOR "Rfio Library Functions" .SH NAME rfio_write \- writes to a file .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_write (int " s ", const void *" ptr ", int " size ");" .SH DESCRIPTION .B rfio_write stores in a file the bytes starting at .BR ptr , a pointer to the memory location in which resides the information, .BI size bytes, using the descriptor .BI s generated by a previous .BR rfio_open . .SH RETURN VALUE This routine returns -1 if the operation failed or the number of items actually writen. In case of failure, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EBADF .I s is not a valid descriptor. .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SETIMEDOUT Timed out. .TP .B SEBADVERSION Version ID mismatch. .TP .B SECONNDROP Connection closed by remote end. .TP .B SECOMERR Communication error. .TP .B SENORCODE Host did not return error number. .SH SEE ALSO .BR Castor_limits(4) , .BR rfio_open(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/xyclose.c0000644000175000017500000000774511336205452015026 0ustar ellertellert/* * $Id: xyclose.c 3172 2010-02-15 08:51:54Z baud $ */ /* * Copyright (C) 1990-2010 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: xyclose.c,v $ $Revision: 3172 $ $Date: 2010-02-15 09:51:54 +0100 (Mon, 15 Feb 2010) $ CERN/IT/PDP/DM Frederic Hemmer"; #endif /* not lint */ /* xyclose.c Remote File I/O - Close a Fortran Logical Unit */ /* * C bindings : * * rfio_xyclose(int lun, char *chopt, int *irc) * * FORTRAN bindings : * * XYCLOS(INTEGER*4 LUN, CHARACTER*(*) CHOPT, INTEGER*4 IRC) */ #define RFIO_KERNEL 1 /* system part of Remote File I/O */ #include "rfio.h" /* remote file I/O definitions */ #include extern int DLL_DECL switch_close(); int DLL_DECL rfio_xyclose(lun, chopt, irc) /* close a remote fortran logical unit */ int lun; char *chopt; int *irc; { char buf[LONGSIZE]; /* network command/response buffer */ register char *p=buf; /* buffer pointer */ int status; /* Fortran status */ register int i; /* general purpose index */ INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio" ,"rfio_xyclose(%d, %s, %x)", lun, chopt, irc); if (ftnlun[lun] == (RFILE *) NULL) { /* Allocated ? */ TRACE(1, "rfio", "rfio_xyclose: %s", "Bad file number"); END_TRACE(); return(EBADF); } /* * Analyze options */ TRACE(2, "rfio", "rfio_xyclose: parsing options: [%s]",chopt); for (i=0;i< (int)strlen(chopt);i++) { switch (chopt[i]) { case ' ': break; default : *irc = SEBADFOPT; END_TRACE(); return(SEBADFOPT); } } *irc = 0; if (!strcmp(ftnlun[lun]->host, "localhost")) { /* Local file ? */ /* Must be a local file */ *irc=switch_close(&lun); (void) free((char *)ftnlun[lun]); ftnlun[lun]=(RFILE *) NULL; END_TRACE(); rfio_errno = 0; return(*irc); } marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_XYCLOS); TRACE(2,"rfio","rfio_xyclose: writing %d bytes",RQSTSIZE) ; if (netwrite_timeout(ftnlun[lun]->s,buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio" ,"rfio_xyclose: write(): ERROR occured (errno=%d)", errno); free((char *)ftnlun[lun]); ftnlun[lun]=(RFILE *) NULL; END_TRACE(); if ( serrno ) return ( serrno ) ; else return(errno); } p = buf; TRACE(2, "rfio" ,"rfio_xyclose: reading %d bytes", LONGSIZE); if (netread_timeout(ftnlun[lun]->s, buf, LONGSIZE, RFIO_CTRL_TIMEOUT) != LONGSIZE) { TRACE(2, "rfio" ,"rfio_xyclose: read(): ERROR occured (errno=%d)", errno); free((char *)ftnlun[lun]); ftnlun[lun]=(RFILE *) NULL; END_TRACE(); if ( serrno ) return ( serrno ) ; else return( errno ); } unmarshall_LONG(p, status); TRACE(1, "rfio", "rfio_xyclose: return %d ",status); END_TRACE(); (void) close(ftnlun[lun]->s); free((char *)ftnlun[lun]); ftnlun[lun]=(RFILE *) NULL; *irc = status; rfio_errno = status ; return(status); } /* * Fortran wrapper */ #if (defined(hpux) && !defined(PPU)) || (defined(_AIX) && !defined(EXTNAME)) #define xyclos_ xyclos #endif /* hpux && !PPU || AIX && !EXTNAME */ #if defined(_WIN32) void _stdcall XYCLOS(flun, fchopt, fchoptl, firc) #else void xyclos_(flun, fchopt, firc, fchoptl) #endif int *flun, *firc; char *fchopt; int fchoptl; { char *chopt; /* xyclos options */ int status; /* xyclos return status */ INIT_TRACE("RFIO_TRACE"); if ((chopt = malloc((unsigned) fchoptl+1)) == NULL) { *firc = -errno; END_TRACE(); return; } strncpy(chopt, fchopt, fchoptl); chopt[fchoptl] = '\0'; TRACE(1, "rfio", "XYCLOS(%d, %s, %x)", *flun, chopt, firc); status = rfio_xyclose(*flun, chopt, firc); if (status) *firc = -status; /* system errors have precedence */ TRACE(1, "rfio", "XYCLOS: status: %d, irc: %d",status,*firc); END_TRACE(); (void) free(chopt); return; } lcgdm-1.10.0/rfio/rfchmod.man0000644000175000017500000000220210222773541015274 0ustar ellertellert.\" .\" $Id: rfchmod.man,v 1.1 2005/03/31 13:13:01 baud Exp $ .\" .\" @(#)$RCSfile: rfchmod.man,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:13:01 $ IN2P3 CC Philippe Gaillardon .\" Copyright (C) 1998-2002 by IN2P3 CC .\" All rights reserved .\" .TH RFCHMOD 1 "$Date: 2005/03/31 13:13:01 $" CASTOR "Rfio User Commands" .SH NAME rfchmod \- change file access permission .SH SYNOPSIS .B rfchmod .IR mode .IR file... .SH DESCRIPTION .IX "\fLrfchmod\fR" .B rfchmod provides an interface to the .B shift remote file I/O daemon (rfiod) for changing the file access permission, so called file mode. .TP .I mode argument allows users to specify the file access permission applied to the file. Only the absolute octal representation of the file access permission is supported. For values of mode, see .BR chmod(1) . .TP .I file argument is either a remote file name of the form: .RS .RS .HP .IB hostname : path .RE .LP or a local file name (not containing the :/ character combination). .RE .LP Modification of the file access permission require authorisation. .SH "SEE ALSO" .BR chmod(1), .BR rfio_chmod(3). .SH "AUTHOR" \fBCASTOR\fP Team lcgdm-1.10.0/rfio/pwrite.c0000644000175000017500000000555411533400617014645 0ustar ellertellert/* * $Id: pwrite.c 4148 2011-03-02 08:36:31Z baud $ */ /* * Copyright (C) 1993-2011 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: pwrite.c,v $ $Revision: 4148 $ $Date: 2011-03-02 09:36:31 +0100 (Wed, 02 Mar 2011) $ CERN/IT/PDP/DM Felix Hassine"; #endif /* not lint */ /* pwrite.c Remote command I/O - write input to a popened command */ #define RFIO_KERNEL 1 /* KERNEL part of the routines */ #include "rfio.h" /* Remote File I/O general definitions */ #include int DLL_DECL rfio_pwrite(ptr, size, items, fp) /* Remote file write */ char *ptr; /* buffer pointer */ int size, items; /* .. size items */ RFILE *fp; /* remote file pointer */ { char buf[BUFSIZ]; /* General input/output buffer */ int status ; char *p=buf; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_pwrite(%x, %d, %d, %x)", ptr, size, items, fp); if (fp == NULL || fp->magic != RFIO_MAGIC) { errno = EBADF; if (fp != NULL) free((char *)fp); END_TRACE(); return(-1); } /* * File is local */ if (fp->s < 0) { status = fwrite(ptr, size, items, fp->fp_save); TRACE(3,"rfio","local pwrite (%x,%d,%d,%x) returns %d",ptr, size, items, &(fp-> fp), status); if ( status == 0 ) serrno = 0; END_TRACE(); rfio_errno = 0; return(status); } marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_FWRITE); marshall_LONG(p, size); marshall_LONG(p, items); if ( items*size > BUFSIZ ) { TRACE(2,"rfio","rfio_pwrite: request too long %d (max %d)",items*size,BUFSIZ); END_TRACE(); serrno = E2BIG; return(-1); } TRACE(2, "rfio", "rfio_pwrite: sending %d bytes", 2*WORDSIZE+2*LONGSIZE); if (netwrite_timeout(fp->s, buf, RQSTSIZE, RFIO_CTRL_TIMEOUT) != RQSTSIZE ) { TRACE(2,"rfio","rfio_pwrite: write(): ERROR occured (errno=%d)",errno); END_TRACE(); return -1; } TRACE(2, "rfio", "rfio_pwrite: sending %d bytes", items*size); p = buf ; marshall_STRING(p,ptr) ; if (netwrite_timeout(fp->s, buf, items*size, RFIO_DATA_TIMEOUT) != (items*size)) { TRACE(2, "rfio", "rfio_pwrite: write(): ERROR occured (errno=%d)", errno); END_TRACE(); return(-1); } p = buf; TRACE(2, "rfio", "rfio_pwrite: reading %d bytes", 2*LONGSIZE); if (netread_timeout(fp->s, buf, 2*LONGSIZE, RFIO_CTRL_TIMEOUT) != (2*LONGSIZE)) { TRACE(2, "rfio", "rfio_pwrite: read(): ERROR occured (errno=%d)", errno); END_TRACE(); return(-1); } unmarshall_LONG(p, status); unmarshall_LONG(p, rfio_errno); TRACE(1, "rfio", "rfio_pwrite: status %d, rfio_errno %d",status,rfio_errno); END_TRACE(); return(status); } lcgdm-1.10.0/rfio/rfio_pread.man0000644000175000017500000000236711066421615015777 0ustar ellertellert.\" .\" $Id: rfio_pread.man,v 1.1 2008/09/24 11:25:01 dhsmith Exp $ .\" .\" @(#)$RCSfile: rfio_pread.man,v $ $Revision: 1.1 $ $Date: 2008/09/24 11:25:01 $ CERN IT-DM Jean-Philippe Baud .\" Copyright (C) 1999-2008 by CERN/IT/DM .\" All rights reserved .\" .TH RFIO_PREAD 3 "$Date: 2008/09/24 11:25:01 $" CASTOR "Rfio Library Functions" .SH NAME rfio_pread \- reads in a file .SH SYNOPSIS .B #include .br \fB#include "rfio_api.h"\fR .sp .BI "int rfio_pread (char *" ptr ", int " size ", int " items ", FILE *" fd ");" .SH DESCRIPTION .B rfio_pread reads .BI items times .BI size bytes, using the descriptor .BI fd generated by a previous .B rfio_popen and strore them at location .BR ptr . .SH RETURN VALUE This routine returns -1 if the operation failed or the number of items actually read. In case of failure, .B serrno is set appropriately. .SH ERRORS .TP 1.3i .B EBADF .I fd is a NULL pointer. .TP .B SENOSHOST Host unknown. .TP .B SENOSSERV Service unknown. .TP .B SETIMEDOUT Timed out. .TP .B SEBADVERSION Version ID mismatch. .TP .B SECONNDROP Connection closed by remote end. .TP .B SECOMERR Communication error. .TP .B SENORCODE Host did not return error number. .SH SEE ALSO .BR rfio_popen(3) .SH AUTHOR \fBCASTOR\fP Team lcgdm-1.10.0/rfio/mstat.c0000644000175000017500000005220110725234467014464 0ustar ellertellert/* * $Id: mstat.c,v 1.4 2007/12/04 11:25:43 dhsmith Exp $ */ /* * Copyright (C) 1995-2005 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: mstat.c,v $ $Revision: 1.4 $ $Date: 2007/12/04 11:25:43 $ CERN/IT/PDP/DM Felix Hassine"; #endif /* not lint */ #include "Cmutex.h" #include "Castor_limits.h" #include #include #include #include #include "log.h" #define RFIO_KERNEL 1 #include "rfio.h" #include #include #include typedef struct socks { char host[CA_MAXHOSTNAMELEN+1]; int s ; int Tid; } mstat_connects ; static mstat_connects mstat_tab[MAXMCON]; /* UP TO MAXMCON connections simultaneously */ EXTERN_C int DLL_DECL rfio_smstat _PROTO((int, char *, struct stat *, int)); static int rfio_mstat_allocentry _PROTO((char *, int, int)); static int rfio_mstat_findentry _PROTO((char *,int)); static int rfio_end_this _PROTO((int,int)); extern int rfio_newhost _PROTO((char *)); int DLL_DECL rfio_mstat(file,statb) char *file ; struct stat *statb; { #if (defined(__alpha) && defined(__osf__)) return (rfio_mstat64(file,statb)); #else int rc, parserc ; #if defined(IRIX64) || defined(__ia64__) || defined(__x86_64) || defined(__ppc64__) struct stat64 statb64; if ((rc = rfio_mstat64(file,&statb64)) == 0) (void) stat64tostat(&statb64, statb); return (rc); #else int rt ,i ,fd, rfindex, Tid; char *host , *filename ; INIT_TRACE("RFIO_TRACE"); Cglobals_getTid(&Tid); TRACE(1, "rfio", "rfio_mstat(%s, %x), Tid=%d", file, statb, Tid); if (!(parserc = rfio_parseln(file,&host,&filename,NORDLINKS))) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file */ rfio_errno = 0; rc = rfio_HsmIf_stat(filename,statb); END_TRACE(); return(rc); } /* The file is local */ rc = stat(filename,statb) ; if ( rc < 0 ) serrno = 0; rfio_errno = 0; END_TRACE(); return (rc) ; } else { if (parserc < 0) { END_TRACE(); return(-1); } /* Look if already in */ serrno = 0; rfindex = rfio_mstat_findentry(host,Tid); TRACE(2, "rfio", "rfio_mstat: rfio_mstat_findentry(host=%s,Tid=%d) returns %d", host, Tid, rfindex); if (rfindex >= 0) { rc = rfio_smstat(mstat_tab[rfindex].s,filename,statb,RQST_MSTAT_SEC ) ; END_TRACE(); return (rc) ; } /* * Open a connection */ rfio_errno = 0; fd=rfio_connect(host,&rt) ; if ( fd < 0 ) { END_TRACE(); return (-1) ; } rfindex = rfio_mstat_allocentry(host,Tid,fd); TRACE(2, "rfio", "rfio_mstat: rfio_mstat_allocentry(host=%s,Tid=%d,s=%d) returns %d", host, Tid, fd, rfindex); serrno = 0; rc = rfio_smstat(fd,filename,statb,RQST_MSTAT_SEC); if ( rfindex < 0 ) { if ( (rc != -1) || (rc == -1 && rfio_errno != 0) ) { TRACE(2,"rfio","rfio_mstat() overflow connect table, host=%s, Tid=%d. Closing %d",host,Tid,fd); netclose(fd); } } END_TRACE(); return (rc) ; } #endif #endif } /* * Simplest operation in stat() : just do a stat() * for 1 filename */ static int pw_key = -1; static int old_uid_key = -1; int DLL_DECL rfio_smstat(s,filename,statbuf,reqst) int s ; char * filename ; struct stat *statbuf ; int reqst ; { char buf[BUFSIZ]; int status; /* remote fopen() status */ int len; int rc; int save_errno, save_serrno; char *p=buf; int uid; int gid; int *old_uid = NULL; struct passwd *pw_tmp; struct passwd *pw = NULL; /* Avoiding Valgrind error messages about uninitialized data */ memset(buf, 0, BUFSIZ); INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_stat(%s, %x)", filename, statbuf); if ( Cglobals_get(&old_uid_key, (void**)&old_uid, sizeof(int)) > 0 ) *old_uid = -1; Cglobals_get(&pw_key, (void**)&pw, sizeof(struct passwd)); len = strlen(filename)+1; if (reqst != RQST_MSTAT_SEC && reqst != RQST_STAT_SEC) { END_TRACE(); return (-1) ; } TRACE(2,"rfio","rfio_stat: preparing stat() request"); marshall_WORD(p, B_RFIO_MAGIC); uid = geteuid() ; gid = getegid () ; if ( uid != *old_uid ) { TRACE(2,"rfio","rfio_stat: uid=%d != *old_uid=%d\n", (int) uid, (int) *old_uid); pw_tmp = Cgetpwuid(uid); if( pw_tmp == NULL ) { TRACE(2, "rfio" ,"rfio_stat: Cgetpwuid(): ERROR occured (errno=%d)",errno); rfio_end_this(s,1); END_TRACE(); return(-1); } memcpy(pw, pw_tmp, sizeof(struct passwd)); *old_uid = uid; } marshall_WORD(p, reqst); len+=2*WORDSIZE + strlen(pw->pw_name) + 1; if ( len > BUFSIZ ) { TRACE(2,"rfio","rfio_stat: request too long %d (max %d)",len,BUFSIZ); END_TRACE(); serrno = E2BIG; return(-1); } marshall_LONG(p, len); p= buf + RQSTSIZE; TRACE(2,"rfio","rfio_stat: using (uid=%d,gid=%d)\n",(int) uid, (int) gid); marshall_WORD(p, uid); marshall_WORD(p, gid); marshall_STRING(p,pw->pw_name); marshall_STRING(p, filename); TRACE(2,"rfio","rfio_stat: sending %d bytes",RQSTSIZE+len) ; if (netwrite_timeout(s,buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { TRACE(2, "rfio", "rfio_stat: write(): ERROR occured (errno=%d)", errno); rfio_end_this(s,0); END_TRACE(); return(-1); } p = buf; TRACE(2, "rfio", "rfio_stat: reading %d bytes", 8*LONGSIZE+5*WORDSIZE); rc = netread_timeout(s, buf, 8*LONGSIZE+5*WORDSIZE, RFIO_CTRL_TIMEOUT); if (rc != 8*LONGSIZE+5*WORDSIZE) { save_errno = errno, save_serrno = serrno; #if !defined(_WIN32) if (rc == 0 || (rc<0 && errno == ECONNRESET)) #else if (rc == 0 || (rc<0 && serrno == SETIMEDOUT)) #endif TRACE(2, "rfio", "rfio_stat: The connection with the server has been broken"); else TRACE(2, "rfio", "rfio_stat: read(): ERROR occured (errno=%d)", errno); rfio_end_this(s, (rc <= 0 ? 0 : 1)); END_TRACE(); errno = save_errno; serrno = save_serrno; return(-1); } unmarshall_WORD(p, statbuf->st_dev); unmarshall_LONG(p, statbuf->st_ino); unmarshall_WORD(p, statbuf->st_mode); unmarshall_WORD(p, statbuf->st_nlink); unmarshall_WORD(p, statbuf->st_uid); unmarshall_WORD(p, statbuf->st_gid); unmarshall_LONG(p, statbuf->st_size); unmarshall_LONG(p, statbuf->st_atime); unmarshall_LONG(p, statbuf->st_mtime); unmarshall_LONG(p, statbuf->st_ctime); unmarshall_LONG(p, status); /* * Inserted here to preserve * backward compatibility with * former stat () protocol */ #if !defined(_WIN32) unmarshall_LONG(p, statbuf->st_blksize); unmarshall_LONG(p, statbuf->st_blocks); #endif TRACE(1, "rfio", "rfio_stat: return %d",status); rfio_errno = status; if (status) { END_TRACE(); return(-1); } END_TRACE(); return(0); } int DLL_DECL rfio_end() { int i,Tid, j=0 ; char buf[RQSTSIZE]; char *p=buf ; int rc = 0; /* Avoiding Valgrind error messages about uninitialized data */ memset(buf, 0, RQSTSIZE); INIT_TRACE("RFIO_TRACE"); Cglobals_getTid(&Tid); TRACE(3,"rfio","rfio_end entered, Tid=%d", Tid); TRACE(3,"rfio","rfio_end: Lock mstat_tab"); if (Cmutex_lock((void *) mstat_tab,-1) != 0) { TRACE(3,"rfio","rfio_end: Cmutex_lock(mstat_tab,-1) error No %d (%s)", errno, strerror(errno)); END_TRACE(); return(-1); } for (i = 0; i < MAXMCON; i++) { if (mstat_tab[i].Tid == Tid) { if ((mstat_tab[i].s >= 0) && (mstat_tab[i].host[0] != '\0')) { p = buf; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_END); marshall_LONG(p, j); TRACE(3,"rfio","rfio_end: close(mstat_tab[%d].s=%d), host=%s, Tid=%d",i,mstat_tab[i].s, mstat_tab[i].host, Tid); if (netwrite_timeout(mstat_tab[i].s,buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(3, "rfio", "rfio_end: netwrite_timeout(): ERROR occured (errno=%d), Tid=%d", errno, Tid); rc = -1; } netclose(mstat_tab[i].s); } mstat_tab[i].s = -1; mstat_tab[i].host[0] = '\0'; mstat_tab[i].Tid = -1; } } TRACE(3,"rfio","rfio_end: Unlock mstat_tab"); if (Cmutex_unlock((void *) mstat_tab) != 0) { TRACE(3,"rfio","rfio_end: Cmutex_unlock(mstat_tab) error No %d (%s)", errno, strerror(errno)); rc = -1; } END_TRACE(); return(rc); } /* This is a simplified version of rfio_end() that just free entry in the table */ /* If flag is set a clean close is tried (write on the socket) */ static int rfio_end_this(s,flag) int s; int flag; { int i,Tid, j=0 ; char buf[RQSTSIZE]; int found = 0; char *p=buf ; int rc = 0; /* Avoiding Valgrind error messages about uninitialized data */ memset(buf, 0, RQSTSIZE); Cglobals_getTid(&Tid); TRACE(3,"rfio","rfio_end_this(s=%d,flag=%d) entered, Tid=%d", s, flag, Tid); TRACE(3,"rfio","rfio_end: Lock mstat_tab"); if (Cmutex_lock((void *) mstat_tab,-1) != 0) { TRACE(3,"rfio","rfio_end_this: Cmutex_lock(mstat_tab,-1) error No %d (%s)", errno, strerror(errno)); return(-1); } for (i = 0; i < MAXMCON; i++) { if (mstat_tab[i].Tid == Tid) { if ((mstat_tab[i].s == s) && (mstat_tab[i].host[0] != '\0')) { found++; if (flag) { marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_END); marshall_LONG(p, j); TRACE(3,"rfio","rfio_end_this: close(mstat_tab[%d].s=%d), host=%s, Tid=%d",i,mstat_tab[i].s, mstat_tab[i].host, Tid); if (netwrite_timeout(mstat_tab[i].s,buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(3, "rfio", "rfio_end_this: netwrite_timeout(): ERROR occured (errno=%d), Tid=%d", errno, Tid); } } netclose(mstat_tab[i].s); mstat_tab[i].s = -1; mstat_tab[i].host[0] = '\0'; mstat_tab[i].Tid = -1; } } } if (! found) netclose(s); TRACE(3,"rfio","rfio_end: Unlock mstat_tab"); if (Cmutex_unlock((void *) mstat_tab) != 0) { TRACE(3,"rfio","rfio_end_this: Cmutex_unlock(mstat_tab) error No %d (%s)", errno, strerror(errno)); rc = -1; } return(rc); } /* * Seach for a free index in the mstat_tab table */ static int rfio_mstat_allocentry(hostname,Tid,s) char *hostname; int Tid; int s; { int i; int rc; TRACE(3,"rfio","rfio_mstat_allocentry entered, Tid=%d", Tid); TRACE(3,"rfio","rfio_mstat_allocentry: Lock mstat_tab"); if (Cmutex_lock((void *) mstat_tab,-1) != 0) { TRACE(3,"rfio","rfio_mstat_allocentry: Cmutex_lock(mstat_tab,-1) error No %d (%s)", errno, strerror(errno)); return(-1); } /* Scan it */ for (i = 0; i < MAXMCON; i++) { if (mstat_tab[i].host[0] == '\0') { rc = i; strncpy(mstat_tab[i].host,hostname,CA_MAXHOSTNAMELEN); mstat_tab[i].host[CA_MAXHOSTNAMELEN] = '\0'; mstat_tab[i].Tid = Tid; mstat_tab[i].s = s; goto _rfio_mstat_allocentry_return; } } serrno = ENOENT; rc = -1; _rfio_mstat_allocentry_return: TRACE(3,"rfio","rfio_mstat_allocentry: Unlock mstat_tab"); if (Cmutex_unlock((void *) mstat_tab) != 0) { TRACE(3,"rfio","rfio_mstat_allocentry: Cmutex_unlock(mstat_tab) error No %d (%s)", errno, strerror(errno)); return(-1); } return(rc); } /* * Seach for a given index in the mstat_tab table */ static int rfio_mstat_findentry(hostname,Tid) char *hostname; int Tid; { int i; int rc; TRACE(3,"rfio","rfio_mstat_findentry entered, Tid=%d", Tid); TRACE(3,"rfio","rfio_mstat_findentry: Lock mstat_tab"); if (Cmutex_lock((void *) mstat_tab,-1) != 0) { TRACE(3,"rfio","rfio_mstat_findentry: Cmutex_lock(mstat_tab,-1) error No %d (%s)", errno, strerror(errno)); return(-1); } /* Scan it */ for (i = 0; i < MAXMCON; i++) { if ((strcmp(mstat_tab[i].host,hostname) == 0) && (mstat_tab[i].Tid == Tid)) { rc = i; /* Lie to rfio_lasthost() */ rfio_newhost(hostname); goto _rfio_mstat_findentry_return; } } serrno = ENOENT; rc = -1; _rfio_mstat_findentry_return: TRACE(3,"rfio","rfio_mstat_findentry: Unlock mstat_tab"); if (Cmutex_unlock((void *) mstat_tab) != 0) { TRACE(3,"rfio","rfio_mstat_findentry: Cmutex_unlock(mstat_tab) error No %d (%s)", errno, strerror(errno)); return(-1); } return(rc); } int DLL_DECL rfio_mstat_reset() { int i,Tid; int rc = 0; INIT_TRACE("RFIO_TRACE"); Cglobals_getTid(&Tid); TRACE(3,"rfio","rfio_mstat_reset entered, Tid=%d", Tid); TRACE(3,"rfio","rfio_mstat_reset: Lock mstat_tab"); if (Cmutex_lock((void *) mstat_tab,-1) != 0) { TRACE(3,"rfio","rfio_mstat_reset: Cmutex_lock(mstat_tab,-1) error No %d (%s)", errno, strerror(errno)); END_TRACE(); return(-1); } for (i = 0; i < MAXMCON; i++) { if ((mstat_tab[i].s >= 0) && (mstat_tab[i].host[0] != '\0')) { TRACE(3,"rfio","rfio_mstat_reset: Resetting socket fd=%d, host=%s\n", mstat_tab[i].s, mstat_tab[i].host); netclose(mstat_tab[i].s); } mstat_tab[i].s = -1; mstat_tab[i].host[0] = '\0'; mstat_tab[i].Tid = -1; } TRACE(3,"rfio","rfio_mstat_reset: Unlock mstat_tab"); if (Cmutex_unlock((void *) mstat_tab) != 0) { TRACE(3,"rfio","rfio_mstat_reset: Cmutex_unlock(mstat_tab) error No %d (%s)", errno, strerror(errno)); rc = -1; } END_TRACE(); return(rc); } int DLL_DECL rfio_mstat64(file,statb) char *file ; struct stat64 *statb; { int rt ,rc ,i ,fd, rfindex, Tid; char *host , *filename ; int fitreqst; /*Fitted request */ int parserc; INIT_TRACE("RFIO_TRACE"); Cglobals_getTid(&Tid); TRACE(1, "rfio", "rfio_mstat64(%s, %x), Tid=%d", file, statb, Tid); if (!(parserc = rfio_parseln(file,&host,&filename,NORDLINKS))) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file */ rfio_errno = 0; rc = rfio_HsmIf_stat64(filename,statb); END_TRACE(); return(rc); } /* The file is local */ rc = stat64(filename, statb) ; if ( rc < 0 ) serrno = 0; rfio_errno = 0; END_TRACE(); return (rc) ; } else { if (parserc < 0) { END_TRACE(); return(-1); } /* Look if already in */ serrno = 0; rfindex = rfio_mstat_findentry(host,Tid); TRACE(2, "rfio", "rfio_mstat64: rfio_mstat_findentry(host=%s,Tid=%d) returns %d", host, Tid, rfindex); if (rfindex >= 0) { rc = rfio_smstat64( mstat_tab[rfindex].s, filename, statb, RQST_MSTAT64 ) ; END_TRACE(); return (rc) ; } /* * Open a connection */ rfio_errno = 0; fd = rfio_connect(host,&rt) ; if ( fd < 0 ) { END_TRACE(); return (-1) ; } rfindex = rfio_mstat_allocentry(host,Tid,fd); TRACE(2, "rfio", "rfio_mstat64: rfio_mstat_allocentry(host=%s,Tid=%d,s=%d) returns %d", host, Tid, fd, rfindex); serrno = 0; rc = rfio_smstat64(fd, filename, statb, RQST_MSTAT64); if (rfindex<0) { if ( (rc != -1) || (rc == -1 && rfio_errno != 0) ) { TRACE(2,"rfio","rfio_mstat() overflow connect table, Tid=%d. Closing %d",Tid,fd); netclose(fd); } } END_TRACE(); return (rc) ; } } /* Do the remote stat64() and lstat64() */ int DLL_DECL rfio_smstat64(s,filename,statbuf,reqst) int s ; char * filename ; struct stat64 *statbuf ; int reqst ; { char buf[BUFSIZ]; int status; /* remote fopen() status */ int len; int replen; int rc; int save_errno, save_serrno; char *p=buf; int uid; int gid; int m64; int *old_uid = NULL; long i32 ; struct passwd *pw_tmp; struct passwd *pw = NULL; /* Avoiding Valgrind error messages about uninitialized data */ memset(buf, 0, BUFSIZ); INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_smstat64(%s, %x)", filename, statbuf); if ( Cglobals_get(&old_uid_key, (void**)&old_uid, sizeof(int)) > 0 ) *old_uid = -1; Cglobals_get(&pw_key, (void**)&pw, sizeof(struct passwd)); len = strlen(filename)+1; switch ( reqst ) { case RQST_MSTAT64: case RQST_STAT64: case RQST_LSTAT64: TRACE(2,"rfio","rfio_smstat64: trying (l)stat64()"); m64 = 1; break; case RQST_MSTAT_SEC: case RQST_STAT_SEC: case RQST_LSTAT_SEC: TRACE(2,"rfio","rfio_smstat64: trying secure (l)stat()"); m64 = 0; break; default: TRACE(2,"rfio","rfio_smstat64: Invalid request %x", reqst); END_TRACE(); return (-1) ; } if (!m64) { marshall_WORD(p, B_RFIO_MAGIC); } else { marshall_WORD(p, RFIO_MAGIC); } marshall_WORD(p, reqst); uid = geteuid() ; gid = getegid () ; if ( uid != *old_uid ) { TRACE(2,"rfio","rfio_smstat64: uid=%d != *old_uid=%d\n", (int) uid, (int) *old_uid); pw_tmp = Cgetpwuid(uid); if( pw_tmp == NULL ) { TRACE(2, "rfio" ,"rfio_smstat64: Cgetpwuid(): ERROR occured (errno=%d)", errno); rfio_end_this(s,1); END_TRACE(); return(-1); } memcpy(pw, pw_tmp, sizeof(struct passwd)); *old_uid = uid; } len += 2*WORDSIZE + strlen(pw->pw_name) + 1; if ( len > BUFSIZ ) { TRACE(2,"rfio","rfio_smstat64: request too long %d (max %d)",len,BUFSIZ); rfio_end_this(s,0); END_TRACE(); serrno = E2BIG; return(-1); } marshall_LONG(p, len); p= buf + RQSTSIZE; TRACE(2,"rfio","rfio_smstat64: using (uid=%d,gid=%d)\n",(int) uid, (int) gid); marshall_WORD(p, uid); marshall_WORD(p, gid); marshall_STRING(p,pw->pw_name); marshall_STRING(p, filename); TRACE(2,"rfio","rfio_smstat64: sending %d bytes", RQSTSIZE+len) ; if (netwrite_timeout(s,buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { TRACE(2, "rfio", "rfio_smstat64: write(): ERROR occured (errno=%d)", errno); rfio_end_this(s,0); END_TRACE(); return(-1); } p = buf; if ( m64 ) replen = 3*HYPERSIZE+5*LONGSIZE+5*WORDSIZE; else { if (reqst == RQST_LSTAT_SEC) replen = 6*LONGSIZE+5*WORDSIZE; else replen = 8*LONGSIZE+5*WORDSIZE; } TRACE(2, "rfio", "rfio_smstat64: reading %d bytes", replen); rc = netread_timeout(s, buf, replen, RFIO_CTRL_TIMEOUT); if ( rc != replen) { save_errno = errno; save_serrno = serrno; #if !defined(_WIN32) if (rc == 0 || (rc<0 && errno == ECONNRESET)) #else if (rc == 0 || (rc<0 && serrno == SETIMEDOUT)) #endif TRACE(2, "rfio", "rfio_smstat64: The connection with the server has been broken"); else TRACE(2, "rfio", "rfio_smstat64: read(): ERROR received %d/%d bytes (errno=%d)", rc, replen, errno); rfio_end_this(s, (rc <= 0 ? 0 : 1)); END_TRACE(); errno = save_errno; serrno = save_serrno; return(-1); } if (m64) { unmarshall_WORD(p, statbuf->st_dev); unmarshall_HYPER(p, statbuf->st_ino); unmarshall_WORD(p, statbuf->st_mode); unmarshall_WORD(p, statbuf->st_nlink); unmarshall_WORD(p, statbuf->st_uid); unmarshall_WORD(p, statbuf->st_gid); unmarshall_HYPER(p, statbuf->st_size); unmarshall_LONG(p, statbuf->st_atime); unmarshall_LONG(p, statbuf->st_mtime); unmarshall_LONG(p, statbuf->st_ctime); unmarshall_LONG(p, status); #if !defined(_WIN32) unmarshall_LONG(p, statbuf->st_blksize); unmarshall_HYPER(p, statbuf->st_blocks); #endif } else { unmarshall_WORD(p, statbuf->st_dev); unmarshall_LONG(p, statbuf->st_ino); unmarshall_WORD(p, statbuf->st_mode); unmarshall_WORD(p, statbuf->st_nlink); unmarshall_WORD(p, statbuf->st_uid); unmarshall_WORD(p, statbuf->st_gid); unmarshall_LONG(p, statbuf->st_size); unmarshall_LONG(p, statbuf->st_atime); unmarshall_LONG(p, statbuf->st_mtime); unmarshall_LONG(p, statbuf->st_ctime); unmarshall_LONG(p, status); #if !defined(_WIN32) if ( reqst != RQST_LSTAT_SEC ) { unmarshall_LONG(p, statbuf->st_blksize); unmarshall_LONG(p, statbuf->st_blocks); } #endif } TRACE(1, "rfio", "rfio_smstat64: return %d", status); rfio_errno = status; if (status) { END_TRACE(); serrno = 0; return(-1); } END_TRACE(); return (0); } int DLL_DECL stat64tostat(statb64, statb) const struct stat64 *statb64; struct stat *statb; { statb->st_dev = statb64->st_dev; statb->st_ino = (ino_t) statb64->st_ino; statb->st_mode = statb64->st_mode; statb->st_nlink = statb64->st_nlink; statb->st_uid = statb64->st_uid; statb->st_gid = statb64->st_gid; statb->st_size = statb64->st_size; statb->st_atime = statb64->st_atime; statb->st_mtime = statb64->st_mtime; statb->st_ctime = statb64->st_ctime; #if !defined(_WIN32) statb->st_blksize= statb64->st_blksize; statb->st_blocks = (int) statb64->st_blocks; #endif return (0); } lcgdm-1.10.0/rfio/access.c0000644000175000017500000000564410222773541014577 0ustar ellertellert/* * $Id: access.c,v 1.1 2005/03/31 13:12:59 baud Exp $ */ /* * Copyright (C) 1990-2002 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: access.c,v $ $Revision: 1.1 $ $Date: 2005/03/31 13:12:59 $ CERN/IT/PDP/DM Felix Hassine"; #endif /* not lint */ /* access.c Remote File I/O - get access status */ #define RFIO_KERNEL 1 #include "rfio.h" /* Remote File I/O general definitions */ int DLL_DECL rfio_access(filepath, mode) /* Remote file access */ char *filepath; /* remote file path */ int mode ; /* Access mode */ { char buf[BUFSIZ]; /* General input/output buffer */ register int s; /* socket descriptor */ int status; /* remote fopen() status */ int len; char *host, *filename; char *p=buf; int rt; int uid ; int gid ; int parserc; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_access(%s, %d)", filepath, mode); if (!(parserc = rfio_parseln(filepath,&host,&filename,NORDLINKS))) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file */ TRACE(1,"rfio","rfio_access: %s is an HSM path",filename); END_TRACE(); rfio_errno = 0; return(rfio_HsmIf_access(filename,mode)); } TRACE(1, "rfio", "rfio_access: using local access(%s, %d)", filename, mode); END_TRACE(); rfio_errno = 0; status = access(filename,mode); if ( status < 0 ) serrno = 0; return(status); } if (parserc < 0) { END_TRACE(); return(-1); } s = rfio_connect(host,&rt); if (s < 0) { END_TRACE(); return(-1); } len = strlen(filename)+ 3*LONGSIZE+1; if ( RQSTSIZE+len > BUFSIZ ) { TRACE(2,"rfio","rfio_access: request too long %d (max %d)", RQSTSIZE+len,BUFSIZ); END_TRACE(); (void) netclose(s); serrno = E2BIG; return(-1); } marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_ACCESS); marshall_LONG(p, len); uid = geteuid() ; gid = getegid() ; p= buf + RQSTSIZE; marshall_STRING(p, filename); marshall_LONG(p, uid) ; marshall_LONG(p, gid) ; marshall_LONG(p, mode); TRACE(2,"rfio","rfio_access: sending %d bytes",RQSTSIZE+len) ; if (netwrite_timeout(s,buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { TRACE(2, "rfio", "rfio_access: write(): ERROR occured (errno=%d)", errno); (void) netclose(s); END_TRACE(); return(-1); } p = buf; TRACE(2, "rfio", "rfio_access: reading %d bytes", LONGSIZE); if (netread_timeout(s, buf, LONGSIZE, RFIO_CTRL_TIMEOUT) != LONGSIZE ) { TRACE(2, "rfio", "rfio_access: read(): ERROR occured (errno=%d)", errno); (void) netclose(s); END_TRACE(); return(-1); } unmarshall_LONG(p, status); TRACE(1, "rfio", "rfio_access: return %d",status); rfio_errno = status; (void) netclose(s); if (status) { END_TRACE(); return(-1); } END_TRACE(); return (0); } lcgdm-1.10.0/rfio/lseek.c0000644000175000017500000003163211540404041014423 0ustar ellertellert/* * $Id: lseek.c 4204 2011-03-17 13:09:53Z baud $ */ /* * Copyright (C) 1990-2011 by CERN/IT/PDP/DM * All rights reserved */ #ifndef lint static char sccsid[] = "@(#)$RCSfile: lseek.c,v $ $Revision: 4204 $ $Date: 2011-03-17 14:09:53 +0100 (Thu, 17 Mar 2011) $ CERN/IT/PDP/DM F. Hemmer, A. Trannoy"; #endif /* not lint */ /* lseek.c Remote File I/O - move read/write file mark. */ /* * System remote file I/O definitions */ #define RFIO_KERNEL 1 #include "rfio.h" #include "rfio_rfilefdt.h" #include /* malloc prototype */ #if !defined(OFF_MAX) #define OFF_MAX 2147483647 #endif /* * Forward declaration. */ static int rfio_lseekinbuf() ; static int rfio_forcelseek() ; /* * Remote file seek */ off_t DLL_DECL rfio_lseek(s, offset, how) int s ; off_t offset ; int how ; { int status ; char rfio_buf[BUFSIZ]; int s_index = -1; INIT_TRACE("RFIO_TRACE") ; TRACE(1,"rfio","rfio_lseek(%d, %d, %x)",s,offset,how) ; #if defined(CLIENTLOG) /* Client logging */ rfio_logls(s,offset,how); #endif /* CLIENTLOG */ /* * The file is local */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1 ) { TRACE(2, "rfio", "rfio_lseek: using local lseek(%d, %ld, %d)",s,offset,how) ; offset= lseek(s,offset,how) ; if ( offset < 0 ) serrno = 0; rfio_errno = 0; END_TRACE() ; return offset ; } /* * Checking 'how' parameter. */ if ( how < 0 || how > 2 ) { errno= EINVAL ; END_TRACE() ; return -1 ; } /* * Checking 'offset' parameter. */ if ( offset < 0 && how == SEEK_SET ) { errno= EINVAL ; END_TRACE(); return -1 ; } /* * Checking magic number */ if ( rfilefdt[s_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(s_index); (void) close(s); END_TRACE(); return -1 ; } /* * Checking mode 64. */ if (rfilefdt[s_index]->mode64) { off64_t offsetin; off64_t offsetout; offsetin = offset; offsetout = rfio_lseek64(s, offsetin, how); if (offsetout > OFF_MAX && sizeof(off_t) == 4) { #if (defined(__osf__) && defined(__alpha)) || defined(hpux) || defined(_WIN32) errno = EINVAL; #else errno = EOVERFLOW; #endif END_TRACE(); return(-1); } offset = offsetout; END_TRACE(); return(offset); } /* If RFIO version 3 enabled, then call the corresponding procedure */ if (rfilefdt[s_index]->version3 == 1) { status= rfio_lseek_v3(s,offset,how); END_TRACE(); return(status); } /* * Changing SEEK_CUR in SEEK_SET. * WARNING !!! Should not be removed. */ if ( how == SEEK_CUR ) { how=SEEK_SET ; offset+= rfilefdt[s_index]->offset ; } /* * A preseek() is active. */ if ( rfilefdt[s_index]->preseek && how != SEEK_END ) { status= rfio_lseekinbuf(s,offset) ; END_TRACE() ; return status ; } /* * If I/O are bufferized and * if the buffer is not empty. */ if ( rfilefdt[s_index]->_iobuf.base && rfilefdt[s_index]->_iobuf.count ) { if ( how != SEEK_END ) { if ( offset >= rfilefdt[s_index]->offset ) { /* * Data is currently in the buffer. */ if ( (offset - rfilefdt[s_index]->offset) <= rfilefdt[s_index]->_iobuf.count ) { rfilefdt[s_index]->_iobuf.count -= offset - rfilefdt[s_index]->offset ; rfilefdt[s_index]->_iobuf.ptr += offset - rfilefdt[s_index]->offset ; rfilefdt[s_index]->offset= offset ; END_TRACE() ; return offset ; } /* * Data should be in the next message. */ else if (rfilefdt[s_index]->readissued && (offset-rfilefdt[s_index]->offset)<=(rfilefdt[s_index]->_iobuf.count+rfilefdt[s_index]->_iobuf.dsize)){ /* * Getting next message. */ rfilefdt[s_index]->offset += rfilefdt[s_index]->_iobuf.count ; rfilefdt[s_index]->_iobuf.ptr= iodata(rfilefdt[s_index]) ; rfilefdt[s_index]->_iobuf.count= 0 ; status= rfio_filbuf(s,rfilefdt[s_index]->_iobuf.base,rfilefdt[s_index]->_iobuf.dsize) ; if ( status < 0 ) { rfilefdt[s_index]->readissued= 0 ; END_TRACE() ; return -1 ; } if ( status != rfilefdt[s_index]->_iobuf.dsize ) { rfilefdt[s_index]->eof= 1 ; rfilefdt[s_index]->readissued= 0 ; } rfilefdt[s_index]->_iobuf.count= status ; /* * Setting buffer pointers to the right place if possible. */ if ( (offset - rfilefdt[s_index]->offset) <= rfilefdt[s_index]->_iobuf.count ) { rfilefdt[s_index]->_iobuf.count -= offset - rfilefdt[s_index]->offset ; rfilefdt[s_index]->_iobuf.ptr += offset - rfilefdt[s_index]->offset ; rfilefdt[s_index]->offset= offset ; END_TRACE() ; return offset ; } } } else { if ((rfilefdt[s_index]->offset-offset)<=(rfilefdt[s_index]->_iobuf.dsize-rfilefdt[s_index]->_iobuf.count) && ( rfilefdt[s_index]->offset - offset ) <= ( rfilefdt[s_index]->_iobuf.ptr - rfilefdt[s_index]->_iobuf.base) ) { rfilefdt[s_index]->_iobuf.count += rfilefdt[s_index]->offset - offset ; rfilefdt[s_index]->_iobuf.ptr -= rfilefdt[s_index]->offset - offset ; rfilefdt[s_index]->offset= offset ; END_TRACE() ; return offset ; } } } } rfilefdt[s_index]->lseekhow= how ; rfilefdt[s_index]->lseekoff= offset ; if ( how == SEEK_END) { status= rfio_forcelseek(s,offset,how) ; if ( offset >= 0 ) rfilefdt[s_index]->eof= 1 ; rfilefdt[s_index]->offset= status ; rfilefdt[s_index]->lseekhow= -1 ; rfilefdt[s_index]->lseekoff= status ; } else { rfilefdt[s_index]->offset= offset ; /* * If RFIO are buffered, * data in cache is invalidated. */ if ( rfilefdt[s_index]->_iobuf.base ) { rfilefdt[s_index]->_iobuf.count=0; rfilefdt[s_index]->_iobuf.ptr = iodata(rfilefdt[s_index]) ; } } END_TRACE() ; return rfilefdt[s_index]->offset ; } /* * Action taken when a preseek() is active and rfio_lseek() is called. * Positionned pointers to the right record. */ static int rfio_lseekinbuf(s,offset) int s ; int offset ; { char * p ; /* Pointer to buffer */ int s_index; INIT_TRACE("RFIO_TRACE") ; TRACE(1,"rfio","rfio_lseekinbuf(%d,%d)",s,offset) ; /* * Scanning records already requested. */ s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN); for(;;rfilefdt[s_index]->nbrecord -- ) { int status ; /* Status of the read() request */ int rcode ; /* Error code if any */ int off ; /* Offset of the current record */ int len ; /* Length requested */ /* * The buffer is empty. */ if ( rfilefdt[s_index]->nbrecord == 0 ) { WORD req ; int msgsiz ; /* * No more data will arrive. */ if ( rfilefdt[s_index]->preseek == 2 ) break ; /* * Filling the buffer. */ msgsiz= rfilefdt[s_index]->_iobuf.hsize + rfilefdt[s_index]->_iobuf.dsize ; TRACE(2,"rfio","rfio_lseekinbuf: reading %d bytes",msgsiz) ; if ( netread_timeout(s,rfilefdt[s_index]->_iobuf.base,msgsiz,RFIO_DATA_TIMEOUT) != msgsiz ) { TRACE(2,"rfio","rfio_lseekinbuf: read() : ERROR occured (errno=%d)",errno) ; break ; } p= rfilefdt[s_index]->_iobuf.base ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p,rcode) ; unmarshall_LONG(p,msgsiz) ; rfio_errno= rcode ; /* * There is an error, * it did not work correctly. */ if ( status == -1 ) break ; /* * Resetting pointers. */ rfilefdt[s_index]->nbrecord= status ; rfilefdt[s_index]->_iobuf.ptr= iodata(rfilefdt[s_index]) ; rfilefdt[s_index]->preseek= ( req == RQST_LASTSEEK ) ? 2 : 1 ; } /* * The current record is the one we are looking for. */ p= rfilefdt[s_index]->_iobuf.ptr ; unmarshall_LONG(p,off) ; unmarshall_LONG(p,len) ; TRACE(2,"rfio","rfio_lseekinbuf: current record is at offset %d and of length %d",off,len) ; if ( off <= offset && offset < off + len ) { rfilefdt[s_index]->offset= offset ; END_TRACE() ; return offset ; } /* * Pointing to the next record. */ unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; if ( status > 0 ) rfilefdt[s_index]->_iobuf.ptr= p + status ; else rfilefdt[s_index]->_iobuf.ptr= p ; } /* * The offset requested in the preseek * does not appear in the preseek list. * an lseek() will be done with the next read(). */ rfilefdt[s_index]->nbrecord= 0 ; rfilefdt[s_index]->preseek= 0 ; rfilefdt[s_index]->lseekhow= SEEK_SET ; rfilefdt[s_index]->lseekoff= offset ; rfilefdt[s_index]->offset= offset ; END_TRACE() ; return offset ; } /* * Forcing remote lseek(). * Necessarry for SEEK_END lseek(). */ static int rfio_forcelseek(s, offset, how) int s ; int offset ; int how ; { char * p ; /* Pointer to buffer */ char * trp ; /* Pointer to temporary buffer */ int temp=0 ; /* Is there a temporary buffer? */ char rfio_buf[BUFSIZ]; int s_index; INIT_TRACE("RFIO_TRACE") ; TRACE(1, "rfio", "rfio_forcelseek(%d, %d, %x)", s, offset, how) ; if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1) { serrno = SEINTERNAL; TRACE(2, "rfio", "rfio_lseek: rfio_rfilefdt_findentry(): ERROR occured (serrno=%d)", serrno); END_TRACE() ; return -1 ; } if ( rfilefdt[s_index]->ahead ) rfilefdt[s_index]->readissued= 0 ; rfilefdt[s_index]->preseek= 0 ; rfilefdt[s_index]->nbrecord= 0 ; rfilefdt[s_index]->eof= 0 ; /* * If RFIO are buffered, * data in cache is invalidate. */ if ( rfilefdt[s_index]->_iobuf.base ) { rfilefdt[s_index]->_iobuf.count=0; rfilefdt[s_index]->_iobuf.ptr = iodata(rfilefdt[s_index]) ; } /* * Sending request. */ p= rfio_buf ; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_LSEEK); marshall_LONG(p, offset); marshall_LONG(p, how); TRACE(2, "rfio", "rfio_forcelseek: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(s,rfio_buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio", "rfio_lseek: write(): ERROR occured (errno=%d)", errno); END_TRACE() ; return -1 ; } /* * If unbuffered I/O, a momentary buffer * is created to read unnecessary data and * to throw it away. */ if ( rfilefdt[s_index]->_iobuf.base == NULL ) { TRACE(3,"rfio","rfio_forcelseek: allocating momentary buffer of size %d",rfilefdt[s_index]->_iobuf.dsize) ; if ( (trp= ( char *) malloc(rfilefdt[s_index]->_iobuf.dsize)) == NULL ) { TRACE(3,"rfio","rfio_forcelseek: malloc(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } } else { trp= iodata(rfilefdt[s_index]) ; } /* * Getting data from the network. */ for(;;) { WORD req ; int status ; int rcode ; int msgsiz ; TRACE(2, "rfio", "rfio_forcelseek: reading %d bytes",rfilefdt[s_index]->_iobuf.hsize) ; if (netread_timeout(s,rfio_buf,rfilefdt[s_index]->_iobuf.hsize,RFIO_DATA_TIMEOUT) != rfilefdt[s_index]->_iobuf.hsize) { TRACE(2,"rfio","rfio_forcelseek: read(): ERROR occured (errno=%d)",errno) ; if ( temp ) (void) free(trp) ; END_TRACE() ; return -1 ; } p = rfio_buf ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p,rcode) ; unmarshall_LONG(p,msgsiz) ; switch(req) { case RQST_LSEEK: rfio_errno = rcode ; if ( temp ) (void) free(trp) ; TRACE(1,"rfio","rfio_lseek: status %d, rcode %d",status,rcode) ; END_TRACE() ; return status ; case RQST_READAHEAD: case RQST_LASTSEEK: case RQST_PRESEEK: /* * At this point a temporary buffer may need to be created * to receive data which is going to be thrown away. */ if ( temp == 0 ) { if ( rfilefdt[s_index]->_iobuf.base==NULL || rfilefdt[s_index]->_iobuf.dsize #include #include #include #include #include #include #include #if defined(_WIN32) #include #endif /* _WIN32 */ static char *ckpath(); char *getconfent(); int main(argc, argv) int argc; char *argv[]; { extern char * optarg ; extern int optind ; int errflg = 0; int mflag = 0; int recursive = 0; char *path,*root_path,*p; int rc, c; mode_t mode = 0777; long int lmode = 0; /* For conversion, then casting to mode IN2P3*/ char *endprt; /* For conversion IN2P3*/ struct stat64 st; #if defined(_WIN32) WSADATA wsadata; #endif /* _WIN32 */ if ( argc < 2 ) { fprintf(stderr,"Usage: %s [-m mode] [-p] dirname ...\n",argv[0]); exit(2); } while ( (c = getopt(argc,argv,"m:p")) != EOF ) { switch(c) { case 'm': /* Converts mode into long then casts it - IN2P3 */ lmode = strtol(optarg, &endprt, 8); if ( lmode > 0 && lmode <= 0777 && *endprt == '\0' ) mode = lmode; else { fprintf(stderr, "Invalid mode '%s'.\n", optarg); exit(2); } mflag++; break; case 'p': recursive++; break; case '?': fprintf(stderr,"Usage: %s [-m mode] [-p] dirname ...\n",argv[0]); exit(2); } } #if defined(_WIN32) if (WSAStartup (MAKEWORD (2, 0), &wsadata)) { fprintf (stderr, "WSAStartup unsuccessful\n"); exit (2); } #endif for (;optind #include #include /* system logger */ #include #include #include #include "rfio.h" /* remote file I/O definitions */ #include "rfio_rfilefdt.h" #include "rfcntl.h" /* remote file control mapping macros */ #include #include #include "Castor_limits.h" #include #include #include #ifndef _WIN32 #if defined(_REENTRANT) || defined(_THREAD_SAFE) #define strtok(X,Y) strtok_r(X,Y,&last) #endif #endif #if !defined(_WIN32) #include #endif #if defined(_AIX) #include #endif #include #if defined(_WIN32) #include #else #include #include /* for inet_ntoa() */ #if ((defined(IRIX5) || defined(IRIX6)) && ! (defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN) && defined(PDP_ENDIAN))) #ifdef LITTLE_ENDIAN #undef LITTLE_ENDIAN #endif #define LITTLE_ENDIAN 1234 #ifdef BIG_ENDIAN #undef BIG_ENDIAN #endif #define BIG_ENDIAN 4321 #ifdef PDP_ENDIAN #undef PDP_ENDIAN #endif #define PDP_ENDIAN 3412 #endif #include #endif int data_rfio_connect(); static int na_key = -1; extern int DLL_DECL isremote_sa _PROTO((struct sockaddr *, char *)); static int set_rcv_sockparam(); static int set_snd_sockparam(); static void rfio_setup_ext_v3(iop,uid,gid,passwd) RFILE *iop; int uid; int gid; int passwd; { extern char * getenv() ; /* External declaration */ char * cp ; /* Character pointer */ int v ; if ( cp= getenv("RFIO_READOPT") ) { v = atoi(cp) ; rfiosetopt(RFIO_READOPT, &v , 4) ; } /* * We don't allow READAHEAD without buffering * until the Ultra bug ( or mine ) is fixed. if ( rfioreadopt(RFIO_READOPT) == 2 ) { v = 3 ; rfiosetopt( RFIO_READOPT, &v ,4) ; } */ iop->magic = RFIO_MAGIC; iop->version3 = 1; iop->mode64 = 0; iop->s = -1; if (uid || gid) iop->mapping=0; else iop->mapping=1; iop->passwd=passwd; /* used only if mapping == 0 */ iop->uid = (uid==0 ? geteuid(): uid); iop->gid = (gid==0 ? getegid(): gid); INIT_TRACE("RFIO_TRACE"); TRACE ( 1,"rfio","rfio_setup_ext(%d,%d,%d)",iop,uid,gid); TRACE ( 2,"rfio","rfio_setup_ext: owner s uid is %d",iop->uid); TRACE ( 2,"rfio","rfio_setup_ext: owner s gid is %d",iop->gid); END_TRACE(); (void) umask(iop->umask=umask(0)); iop->ftype = FFTYPE_C; iop->binary = 0; /* no translation needed */ iop->eof = 0; iop->unit = 0; iop->access = 0; iop->format = 0; iop->recl = 0; iop->blank = 0; iop->opnopt = 0; iop->offset= 0 ; iop->_iobuf.base = NULL; iop->_iobuf.ptr = NULL; iop->_iobuf.count = 0; iop->_iobuf.hsize = 0; iop->_iobuf.dsize = 0; iop->lseekhow= -1 ; iop->ahead= rfioreadopt(RFIO_READOPT) & RFIO_READAHEAD ; iop->eof= 0 ; iop->readissued= 0 ; iop->preseek = 0 ; iop->nbrecord= 0 ; strcpy(iop->host,"????????"); } int rfio_cleanup_v3(s) /* cleanup rfio descriptor */ int s; { int s_index; int HsmType; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_cleanup_v3(%d)", s); if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) != -1) { if (rfilefdt[s_index]->magic != RFIO_MAGIC && rfilefdt[s_index]->magic != B_RFIO_MAGIC) { serrno = SEBADVERSION ; END_TRACE(); return(-1); } if (rfilefdt[s_index]->_iobuf.base != NULL) { TRACE(2, "rfio", "freeing I/O buffer at 0X%X", rfilefdt[s_index]->_iobuf.base); (void) free(rfilefdt[s_index]->_iobuf.base); } TRACE(2, "rfio", "freeing RFIO descriptor at 0X%X", rfilefdt[s_index]); rfio_rfilefdt_freeentry(s_index); TRACE(2, "rfio", "closing %d",s) ; HsmType = rfio_HsmIf_GetHsmType(s,NULL); if ( HsmType > 0 ) { int status = rfio_HsmIf_close(s); if ( HsmType != RFIO_HSM_CNS ) { END_TRACE(); return(status); } } (void) close(s) ; } END_TRACE(); return(0); } int DLL_DECL rfio_open_v3(filepath, flags, mode) char * filepath ; int flags,mode ; { char rh[1] ; rh[0]='\0' ; return(rfio_open_ext_v3(filepath, flags, mode,(uid_t)0,(gid_t)0,0,rh,rh)); } /* * Remote file open. */ int rfio_open_ext_v3(filepath, flags, mode,uid,gid,passwd,reqhost,vmstr) char * filepath ; int flags,mode ; uid_t uid; gid_t gid; int passwd ; char * reqhost; /* In case of a Non-mapped I/O with uid & gid sepcified, which host will be contacted for key check ? */ char *vmstr ; { /* * TODO: support special filemode for binary/nobinary. This only * applies to non-ascii machines (e.g. IBM VM/MVS) */ int status ; /* Return code */ int rcode ; /* Remote errno */ int len ; int save_errno, save_serrno; char * host ; char * filename; char * account; char * p ; /* Pointer to rfio buffer */ RFILE * rfp ; /* Remote file pointer */ WORD req ; struct passwd *pw; int rt ; /* daemon in site(0) or not (1) */ int bufsize ; /* socket buffer size */ struct sockaddr_storage to; int tolen; extern void rfio_setup_ext_v3(); extern char * getacct() ; extern char * getifnam() ; int data_port; int rem; int rb; int yes; char rfio_buf[BUFSIZ]; int rfp_index, parserc; const char *tname, *tip; INIT_TRACE("RFIO_TRACE"); TRACE(1,"rfio","rfio_open_ext(%s, %d, %d, %d, %d, %d, %s, %s)",filepath,flags,mode,uid,gid,passwd,reqhost,vmstr ) ; #if defined (CLIENTLOG) /* Client logging */ rfio_logst(); #endif /* CLIENTLOG */ /* * The file is local. */ if ( ! (parserc = rfio_parse(filepath,&host,&filename)) ) { /* if not a remote file, must be local or HSM */ if ( host != NULL ) { /* * HSM file */ TRACE(1,"rfio","rfio_open_ext: %s is an HSM path", filename); END_TRACE(); rfio_errno = 0; return(rfio_HsmIf_open(filename,flags,mode,0)); } status= open(filename, flags, mode) ; END_TRACE() ; rfio_errno = 0; #if defined (CLIENTLOG) /* Client logging */ rfio_logop(status,filename,host,flags); #endif /* CLIENTLOG */ return status ; } if (parserc < 0) { END_TRACE(); return(-1); } /* * Allocate and initialize a remote file descriptor. */ if ((rfp = (RFILE *)malloc(sizeof(RFILE))) == NULL) { save_errno = errno; TRACE(2, "rfio", "rfio_open: malloc(): ERROR occured (errno=%d)", errno); END_TRACE(); errno = save_errno; return(-1); } rfio_setup_ext_v3(rfp,(int)uid,(int)gid,passwd) ; TRACE(2, "rfio", "RFIO descriptor allocated at 0x%X", rfp); /* * Connecting server. */ rfp->s = rfio_connect(host,&rt); if (rfp->s < 0) { save_errno = errno; TRACE(2, "rfio", "Failing Doing first connect"); TRACE(2, "rfio", "freeing RFIO descriptor at 0X%X", rfp); (void) free(rfp); END_TRACE(); errno = save_errno; return(-1); } tolen=sizeof(to); if (getpeername(rfp->s,(struct sockaddr *)&to, &tolen)<0) { save_errno = errno; syslog(LOG_ALERT, "rfio: open: getpeername: %s\n",strerror(errno)); TRACE(2, "rfio", "rfio_open: getpeername: %s\n", strerror(errno)); close(rfp->s); (void) free(rfp); END_TRACE(); errno = save_errno; return(-1); } tname = Cgetnetaddress(-1, &to, tolen, &na_key, &tip, NULL, 0, 0); if (tname == NULL || strlen(tip)>=RESHOSTNAMELEN) { TRACE(2, "rfio", "rfio_open: Cgetnetaddress: %s\n",(tname == NULL) ? sstrerror(serrno) : "Names too long"); close(rfp->s); (void) free(rfp); END_TRACE(); return(-1); } if (strlen(tname)host, tname); else strcpy(rfp->host, tip); if ( !rt && !rfp->mapping ) { rfp->uid=geteuid() ; rfp->gid=getegid() ; TRACE(3,"rfio", "re-setting (uid,gid) to %d,%d",rfp->uid,rfp->gid) ; rfp->mapping = 1 ; } /* * Remote file table is not large enough. */ if ((rfp_index = rfio_rfilefdt_allocentry(rfp->s)) == -1) { TRACE(2, "rfio", "freeing RFIO descriptor at 0X%X", rfp); (void) close(rfp->s); (void) free(rfp); END_TRACE(); errno= EMFILE ; return -1 ; } rfilefdt[rfp_index]=rfp; bufsize= DEFIOBUFSIZE ; /* reset error code */ serrno=0; /* Initialization needed for RFIO version 3 write and read requests */ rfp->first_write = 1; rfp->byte_written_to_network = 0; rfp->first_read = 1; rfp->byte_read_from_network = 0; /* Set the keepalive option on socket */ yes = 1; if (setsockopt(rfp->s,SOL_SOCKET,SO_KEEPALIVE,(char *)&yes, sizeof(yes)) < 0) { TRACE(2,"rfio","setsockopt keepalive on ctrl: %s",strerror(errno)); } TRACE(2,"rfio","setsockopt keepalive on ctrl done"); #if (defined(__osf__) && defined(__alpha) && defined(DUXV4)) /* Set the keepalive interval to 20 mns instead of the default 2 hours */ yes = 20 * 60; if (setsockopt(rfp->s,IPPROTO_TCP,TCP_KEEPIDLE,(char *)&yes,sizeof(yes)) < 0) { TRACE(2,"rfio","setsockopt keepidle on ctrl: %s",strerror(errno)); } TRACE(2,"rfio","setsockopt keepidle on ctrl done (%d s)",yes); #endif #if !(defined(__osf__) && defined(__alpha) && defined(DUXV4)) yes = 1; if (setsockopt(rfp->s,IPPROTO_TCP,TCP_NODELAY,(char *)&yes,sizeof(yes)) < 0) { TRACE(2,"rfio","setsockopt nodelay on ctrl: %s",strerror(errno)); } TRACE(2,"rfio","setsockopt nodelay option set on ctrl socket"); #endif /* !(defined(__osf__) && defined(__alpha) && defined(DUXV4)) */ /* * Allocate, if necessary, an I/O buffer. */ rfp->_iobuf.hsize= 3*LONGSIZE + WORDSIZE ; if ( rfioreadopt(RFIO_READOPT) & RFIO_READBUF ) { rfp->_iobuf.dsize = bufsize - rfp->_iobuf.hsize; rfp->_iobuf.count = 0; rfp->_iobuf.ptr = iodata(rfp) ; } if ( (pw = Cgetpwuid(geteuid()) ) == NULL ) { save_errno = errno; save_serrno = serrno; TRACE(2, "rfio" ,"rfio_open_v3: Cgetpwuid() error %s",strerror(errno)); rfio_cleanup_v3(rfp->s); END_TRACE(); serrno = save_serrno; errno = save_errno; return -1 ; } /* * Building and sending request. */ /* if ((account = getacct()) == NULL) */ account = ""; TRACE(2,"rfio","rfio_open: uid %d gid %d umask %o ftype %d, mode %d, flags %d", rfp->uid,rfp->gid,rfp->umask,rfp->ftype,mode,flags) ; TRACE(2,"rfio","rfio_open: account: %s",account) ; TRACE(2,"rfio","rfio_open: filename: %s",filename) ; if (reqhost != NULL && strlen(reqhost) ) TRACE(2,"rfio","rfio_open: requestor's host: %s",reqhost) ; p= rfio_buf ; len= 5*WORDSIZE + 3*LONGSIZE + strlen(account) + strlen(filename) +strlen(pw->pw_name) + strlen(reqhost) + strlen(vmstr) + 5 ; marshall_WORD(p,B_RFIO_MAGIC) ; marshall_WORD(p,RQST_OPEN_V3) ; marshall_LONG(p,len) ; p= rfio_buf + RQSTSIZE ; marshall_WORD(p,rfp->uid) ; marshall_WORD(p,rfp->gid) ; marshall_WORD(p,rfp->umask) ; marshall_WORD(p,FFTYPE_C) ; marshall_LONG(p,htonopnflg(flags)) ; marshall_LONG(p,mode) ; marshall_STRING(p,account) ; marshall_STRING(p,filename) ; marshall_STRING(p,pw->pw_name) ; marshall_STRING(p,reqhost) ; marshall_LONG(p,rfp->passwd); marshall_WORD(p,rfp->mapping); marshall_STRING(p, vmstr) ; TRACE(2,"rfio","rfio_open_v3: sending %d bytes",RQSTSIZE+len) ; save_serrno = serrno; serrno = 0; save_errno = errno; errno = 0; if (netwrite_timeout(rfp->s,rfio_buf,RQSTSIZE+len,RFIO_CTRL_TIMEOUT) != (RQSTSIZE+len)) { save_errno = errno; save_serrno = serrno; TRACE(2,"rfio","rfio_open_v3: write(): ERROR occured (errno=%d)", errno) ; syslog(LOG_ALERT, "rfio: open_v3: %s (error %d , serrno %d with %s) [uid=%d,gid=%d,pid=%d] in netwrite(%d,0X%X,%d)", strerror(errno > 0 ? errno : serrno), errno, serrno, rfp->host, rfp->uid, rfp->gid, getpid(), rfp->s, rfio_buf, RQSTSIZE+len); rfio_cleanup_v3(rfp->s) ; END_TRACE() ; serrno = save_serrno; errno = save_errno; return -1 ; } serrno = save_serrno; errno = save_errno; /* * Getting status and current offset. */ TRACE(1, "rfio", "rfio_open_v3: reading %d bytes",rfp->_iobuf.hsize) ; save_serrno = serrno; serrno = 0; save_errno = errno; errno = 0; /* * We need to increase the timeout on this netread() because if we * miss this message the server will hang forever (it will be stuck * in an accept() on the data socket). A better solution on the * server side is needed to more properly cope with this problem. */ if ((rb = netread_timeout(rfp->s,rfio_buf,RQSTSIZE,10*RFIO_CTRL_TIMEOUT)) != RQSTSIZE ) { save_errno = errno; save_serrno = serrno; #if !defined(_WIN32) if (rb == 0 || (rb<0 && errno == ECONNRESET)) #else if (rb == 0 || (rb<0 && serrno == SETIMEDOUT)) #endif TRACE(2, "rfio", "rfio_open_v3: The connection with the server has been broken"); else { TRACE(2, "rfio", "rfio_open_v3: read(): ERROR occured (errno=%d)", errno); syslog(LOG_ALERT, "rfio: open_v3: %s (error %d, serrno %d with %s) [uid=%d,gid=%d,pid=%d] in netread(%d,0X%X,%d)", strerror(errno > 0 ? errno : serrno), errno, serrno, rfp->host, rfp->uid, rfp->gid, getpid(), rfp->s, rfio_buf, RQSTSIZE); } rfio_cleanup_v3(rfp->s); END_TRACE(); serrno = save_serrno; errno = save_errno; return(-1); } serrno = save_serrno; errno = save_errno; p= rfio_buf ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; unmarshall_LONG(p, data_port); TRACE(1,"rfio","rfio_open_v3: return status(%d), rcode(%d), fd: %d",status,rcode,rfp->s) ; /* will have to check if server doesn't support OPEN_V3 */ if ( status < 0 ) { if ( rcode >= SEBASEOFF) serrno = rcode ; else rfio_errno= rcode ; rfio_cleanup_v3(rfp->s) ; END_TRACE() ; /* Operation failed but no error message was sent */ if ( rcode == 0 ) serrno = SENORCODE ; return -1 ; } else { rfp->offset= status ; } /* use the remote address of the control connection, * but change to the data_port number */ switch(to.ss_family) { case AF_INET: ((struct sockaddr_in *)&to)->sin_port = htons(data_port); break; case AF_INET6: ((struct sockaddr_in6 *)&to)->sin6_port = htons(data_port); break; default: TRACE(2,"rfio","unknown address family: %d",to.ss_family); rfio_cleanup_v3(rfp->s); END_TRACE() ; #if defined(_WIN32) WSASetLastError(WSAEAFNOSUPPORT); #else errno = EAFNOSUPPORT; #endif return (-1); } /* lseekhow field contains the fd of the data socket */ /* Add error checking here ! (-1)*/ rfp->lseekhow = data_rfio_connect((struct sockaddr *)&to,tolen,host,&rem,flags); /* In case of network errors, abort */ if (rfp->lseekhow == -1) { save_errno = errno; save_serrno = serrno; rfio_cleanup_v3(rfp->s) ; END_TRACE() ; serrno = save_serrno; errno = save_errno; return -1 ; } /* Set the keepalive option on both sockets */ yes = 1; if (setsockopt(rfp->lseekhow,SOL_SOCKET,SO_KEEPALIVE,(char *)&yes, sizeof(yes)) < 0) { TRACE(2,"rfio","setsockopt keepalive on data: %s",strerror(errno)); } TRACE(2,"rfio","setsockopt keepalive on data done"); #if (defined(__osf__) && defined(__alpha) && defined(DUXV4)) /* Set the keepalive interval to 20 mns instead of the default 2 hours */ yes = 20 * 60; if (setsockopt(rfp->lseekhow,IPPROTO_TCP,TCP_KEEPIDLE,(char *)&yes,sizeof(yes)) < 0) { TRACE(2,"rfio","setsockopt keepidle on data: %s",strerror(errno)); } TRACE(2,"rfio","setsockopt keepidle on data done (%d s)",yes); #endif #if !(defined(__osf__) && defined(__alpha) && defined(DUXV4)) yes = 1; if (setsockopt(rfp->lseekhow,IPPROTO_TCP,TCP_NODELAY,(char *)&yes,sizeof(yes)) < 0) { TRACE(2,"rfio","setsockopt nodelay on data: %s",strerror(errno)); } TRACE(2,"rfio","setsockopt nodelay option set on data socket"); #endif /* !(defined(__osf__) && defined(__alpha) && defined(DUXV4)) */ #if defined (CLIENTLOG) /* Client logging */ rfio_logop(rfp->s,filename,host,flags); #endif /* * The file is open, update rfp->fp */ #if defined(hpux) rfp->fp.__fileL = rfp->s; #else #if defined(linux) rfp->fp._fileno = rfp->s; #else #if defined(__Lynx__) rfp->fp._fd = rfp->s; #else rfp->fp._file = rfp->s; #endif /* __Lynx__ */ #endif /* linux */ #endif /* hpux */ END_TRACE() ; return (rfp->s) ; } void rfio_setup_v3(iop) RFILE *iop; { (void)rfio_setup_ext_v3(iop,0,0,0); } /* * Remote file read */ int DLL_DECL rfio_read_v3(ctrl_sock, ptr, size) char *ptr; int ctrl_sock, size; { int status ; /* Return code of called func */ int HsmType, save_errno; char * p ; /* Pointer to buffer */ fd_set fdvar; struct timeval t; int req; char *iobuffer; int byte_in_buffer; int n; char rqstbuf[BUFSIZ]; char rfio_buf[BUFSIZ]; int ctrl_sock_index; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_read_v3(%d, %x, %d)", ctrl_sock, ptr, size) ; #if defined (CLIENTLOG) /* Client logging */ rfio_logrd(ctrl_sock,size); #endif /* * Check HSM type. The CASTOR HSM uses normal RFIO (local or remote) * to perform the I/O. Thus we don't call rfio_HsmIf_read(). */ HsmType = rfio_HsmIf_GetHsmType(ctrl_sock,NULL); if ( HsmType > 0 ) { if ( HsmType != RFIO_HSM_CNS ) { status = rfio_HsmIf_read(ctrl_sock,ptr,size); if ( status == -1 ) { save_errno = errno; rfio_HsmIf_IOError(ctrl_sock,errno); errno = save_errno; } END_TRACE(); return(status); } } /* * The file is local. */ if ((ctrl_sock_index = rfio_rfilefdt_findentry(ctrl_sock,FINDRFILE_WITHOUT_SCAN)) == -1) { TRACE(2, "rfio", "rfio_read_v3: using local read(%d, %x, %d)", ctrl_sock, ptr, size); status = read(ctrl_sock, ptr, size); if ( HsmType == RFIO_HSM_CNS ) { save_errno = errno; rfio_HsmIf_IOError(ctrl_sock,errno); errno = save_errno; } END_TRACE(); rfio_errno = 0; return(status); } /* * Checking magic number. */ if (rfilefdt[ctrl_sock_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(ctrl_sock_index); (void) close(ctrl_sock) ; END_TRACE(); return(-1); } /* * Checking mode 64. */ if (rfilefdt[ctrl_sock_index]->mode64) { status = rfio_read64_v3(ctrl_sock, ptr, size); END_TRACE(); return(status); } if (rfilefdt[ctrl_sock_index]->first_read) { rfilefdt[ctrl_sock_index]->first_read = 0; rfilefdt[ctrl_sock_index]->eof_received = 0; /* * Sending request using control socket. */ p = rfio_buf; marshall_WORD(p,RFIO_MAGIC); marshall_WORD(p,RQST_READ_V3); TRACE(2, "rfio", "rfio_read_v3: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(ctrl_sock, rfio_buf, RQSTSIZE, RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2,"rfio","rfio_read_v3: write(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } TRACE(2,"rfio", "rfio_read_v3: reading %d bytes",RQSTSIZE) ; if ((n = netread_timeout(ctrl_sock,rqstbuf,RQSTSIZE,RFIO_CTRL_TIMEOUT)) != RQSTSIZE) { if (n == 0) TRACE(2, "rfio","read ctrl socket: read(): %s\n", sstrerror(serrno)); else TRACE(2, "rfio","read ctrl socket: read(): %s\n", strerror(errno)); END_TRACE(); return -1 ; } p = rqstbuf; unmarshall_WORD(p,req) ; unmarshall_LONG(p,rfilefdt[ctrl_sock_index]->filesize) ; TRACE(2,"rfio", "rfio_read_v3: filesize is %d bytes",rfilefdt[ctrl_sock_index]->filesize) ; } iobuffer = ptr; byte_in_buffer = 0; while (1) { /* EOF received previously but not all data read */ if (rfilefdt[ctrl_sock_index]->eof_received) { if (rfilefdt[ctrl_sock_index]->filesize == rfilefdt[ctrl_sock_index]->byte_read_from_network) { /* End of file and all data has been readby the client */ TRACE(2,"rfio","rfio_read: request satisfied eof encountered (read returns %d)",byte_in_buffer); END_TRACE(); return(byte_in_buffer); } else { int to_be_read; to_be_read = rfilefdt[ctrl_sock_index]->filesize - rfilefdt[ctrl_sock_index]->byte_read_from_network; TRACE(2,"rfio","filesize=%d,byte_read=%d,size=%d,buffer=%d,toberead=%d",rfilefdt[ctrl_sock_index]->filesize,rfilefdt[ctrl_sock_index]->byte_read_from_network,size,byte_in_buffer,to_be_read); if (size-byte_in_buffer <= to_be_read) { /* Receiving data using data socket */ TRACE(2,"rfio","datarfio_read_v3: reading %d bytes from datasocket filedesc=%d",size-byte_in_buffer,rfilefdt[ctrl_sock_index]->lseekhow) ; if ((n = netread_timeout(rfilefdt[ctrl_sock_index]->lseekhow, iobuffer, size-byte_in_buffer,RFIO_DATA_TIMEOUT)) != size-byte_in_buffer) { if (n == 0) TRACE(2,"rfio","datarfio_read_v3: read(): ERROR occured (serrno=%d)",serrno) ; else TRACE(2,"rfio","datarfio_read_v3: read(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } rfilefdt[ctrl_sock_index]->byte_read_from_network += (size - byte_in_buffer); byte_in_buffer = size; TRACE(2,"rfio","rfio_read_v3: request satisfied after eof met"); ; END_TRACE(); return(size); } else { if (size-byte_in_buffer > to_be_read) { /* Receiving data using data socket */ TRACE(2,"rfio","datarfio_read_v3: reading %d bytes from datasocket (to_be_read)",to_be_read,rfilefdt[ctrl_sock_index]->lseekhow) ; if ((n = netread_timeout(rfilefdt[ctrl_sock_index]->lseekhow, iobuffer, to_be_read, RFIO_DATA_TIMEOUT)) != to_be_read) { if (n == 0) TRACE(2,"rfio","datarfio_read_v3: read(): ERROR occured (serrno=%d)",serrno) ; else TRACE(2,"rfio","datarfio_read_v3: read(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } rfilefdt[ctrl_sock_index]->byte_read_from_network += to_be_read; byte_in_buffer += to_be_read; TRACE(2,"rfio","rfio_read_v3: request partially satisfied : %d bytes",byte_in_buffer); END_TRACE(); return(byte_in_buffer); } } } } else { FD_ZERO(&fdvar); FD_SET(ctrl_sock,&fdvar); FD_SET(rfilefdt[ctrl_sock_index]->lseekhow,&fdvar); t.tv_sec = 10; t.tv_usec = 0; TRACE(2,"rfio","read_v3: doing select") ; if (select(FD_SETSIZE,&fdvar,NULL,NULL,&t) < 0) { TRACE(2,"rfio","read_v3: select failed (errno=%d)",errno) ; END_TRACE() ; return -1 ; } if (FD_ISSET(ctrl_sock,&fdvar)) { int cause,rcode; int n; char rqstbuf[BUFSIZ]; /* Something received on the control socket */ TRACE(2,"rfio", "ctrl socket: reading %d bytes",RQSTSIZE) ; if ((n = netread_timeout(ctrl_sock,rqstbuf,RQSTSIZE,RFIO_CTRL_TIMEOUT)) != RQSTSIZE) { if (n == 0) TRACE(2, "rfio","read ctrl socket: read(): %s", sstrerror(serrno)); else TRACE(2, "rfio","read ctrl socket: read(): %s", strerror(errno)); END_TRACE(); return -1 ; } p = rqstbuf; unmarshall_WORD(p,cause) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p,rcode) ; if (cause == REP_ERROR) { TRACE(2,"rfio", "read_v3: reply error status %d, rcode %d", status, rcode) ; rfio_errno = rcode; TRACE(2,"rfio","read_v3: sending ack for error") ; if (netwrite_timeout(ctrl_sock, rqstbuf, RQSTSIZE, RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2,"rfio","read_v3: write(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } if ( HsmType == RFIO_HSM_CNS ) rfio_HsmIf_IOError(ctrl_sock,(rfio_errno > 0 ? rfio_errno : serrno)); END_TRACE(); return(-1); } if (cause == REP_EOF) { rfilefdt[ctrl_sock_index]->eof_received = 1; TRACE(2,"rfio", "read_v3: eof received") ; } } if (FD_ISSET(rfilefdt[ctrl_sock_index]->lseekhow,&fdvar)) { /* Receiving data using data socket */ /* Do not use read here because NT doesn't support that with socket fds */ if ((n = s_nrecv(rfilefdt[ctrl_sock_index]->lseekhow, iobuffer, size-byte_in_buffer)) <= 0) { if (n == 0) TRACE(2,"rfio","datarfio_read_v3: read(): ERROR occured (serrno=%d)",serrno) ; else TRACE(2,"rfio","datarfio_read_v3: read(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } byte_in_buffer += n; rfilefdt[ctrl_sock_index]->byte_read_from_network += n; iobuffer += n; TRACE(2,"rfio","rfio_read: receiving datasocket=%d,buffer=%d,req=%d",n,byte_in_buffer,size) ; if (byte_in_buffer == size) { TRACE(2,"rfio","rfio_read: request satisfied completely"); ; END_TRACE(); return(size); } } } } } /* * Remote file write */ int DLL_DECL rfio_write_v3(ctrl_sock, ptr, size) char *ptr; int ctrl_sock, size; { int status ; /* Return code of called func */ int HsmType, save_errno, written_to; char * p ; /* Pointer to buffer */ fd_set fdvar; struct timeval t; char rfio_buf[BUFSIZ]; int ctrl_sock_index; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_write_v3(%d, %x, %d)", ctrl_sock, ptr, size) ; #if defined (CLIENTLOG) /* Client logging */ rfio_logwr(ctrl_sock,size); #endif /* * Check HSM type and if file has been written to. The CASTOR HSM * uses normal RFIO (local or remote) to perform the I/O. Thus we * don't call rfio_HsmIf_write(). */ HsmType = rfio_HsmIf_GetHsmType(ctrl_sock,&written_to); if ( HsmType > 0 ) { if ( written_to == 0 && (status = rfio_HsmIf_FirstWrite(ctrl_sock,ptr,size)) < 0 ) { END_TRACE(); return(status); } if ( HsmType != RFIO_HSM_CNS ) { status = rfio_HsmIf_write(ctrl_sock,ptr,size); if ( status == -1 ) rfio_HsmIf_IOError(ctrl_sock,errno); END_TRACE(); return(status); } } /* * The file is local. */ if ((ctrl_sock_index = rfio_rfilefdt_findentry(ctrl_sock,FINDRFILE_WITHOUT_SCAN)) == -1) { TRACE(2, "rfio", "rfio_write_v3: using local write(%d, %x, %d)", ctrl_sock, ptr, size); status = write(ctrl_sock, ptr, size); if ( HsmType == RFIO_HSM_CNS ) { save_errno = errno; rfio_HsmIf_IOError(ctrl_sock,errno); errno = save_errno; } END_TRACE(); rfio_errno = 0; return(status); } /* * Checking magic number. */ if (rfilefdt[ctrl_sock_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(ctrl_sock_index); (void) close(ctrl_sock) ; END_TRACE(); return(-1); } /* * Checking mode 64. */ if (rfilefdt[ctrl_sock_index]->mode64) { status = rfio_write64_v3(ctrl_sock, ptr, size); END_TRACE(); return(status); } if (rfilefdt[ctrl_sock_index]->first_write) { rfilefdt[ctrl_sock_index]->first_write = 0; /* * Sending request using control socket. */ p = rfio_buf; marshall_WORD(p,RFIO_MAGIC); marshall_WORD(p,RQST_WRITE_V3); TRACE(2, "rfio", "rfio_write_v3: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(ctrl_sock, rfio_buf, RQSTSIZE, RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2,"rfio","rfio_write_v3: write(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } } FD_ZERO(&fdvar); FD_SET(ctrl_sock,&fdvar); t.tv_sec = 0; t.tv_usec = 0; TRACE(2,"rfio","write_v3: doing select"); /* Immediate return here to send data as fast as possible */ if (select(FD_SETSIZE,&fdvar,NULL,NULL,&t) < 0) { TRACE(2,"rfio","write_v3: select failed (errno=%d)",errno) ; END_TRACE() ; return -1 ; } if (FD_ISSET(ctrl_sock,&fdvar)) { int cause,rcode; int n; char rqstbuf[BUFSIZ]; /* Something received on the control socket */ TRACE(2,"rfio", "ctrl socket: reading %d bytes",RQSTSIZE) ; if ((n = netread_timeout(ctrl_sock,rqstbuf,RQSTSIZE,RFIO_CTRL_TIMEOUT)) != RQSTSIZE) { if (n == 0) TRACE(2, "rfio","read ctrl socket: read(): %s\n", sstrerror(serrno)); else TRACE(2, "rfio","read ctrl socket: read(): %s\n", strerror(errno)); END_TRACE(); return -1 ; } p = rqstbuf; unmarshall_WORD(p,cause) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p,rcode) ; if (cause == REP_ERROR) TRACE(2,"rfio", "write_v3: reply error status %d, rcode %d", status, rcode) ; else TRACE(2,"rfio", "write_v3: unknown error status %d, rcode %d", status, rcode) ; rfio_errno = rcode; TRACE(2,"rfio","rfio_write: sending ack for error") ; if (netwrite_timeout(ctrl_sock, rqstbuf, RQSTSIZE, RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2,"rfio","rfio_write_v3: write(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } if ( status < 0 ) rfio_HsmIf_IOError(ctrl_sock,rfio_errno); END_TRACE(); return(-1); } /* Sending data using data socket */ TRACE(2,"rfio","rfio_write: sending %d bytes to datasocket filedesc=%d",size,rfilefdt[ctrl_sock_index]->lseekhow) ; if (netwrite_timeout(rfilefdt[ctrl_sock_index]->lseekhow, ptr, size, RFIO_DATA_TIMEOUT) != size) { TRACE(2,"rfio","datarfio_write_v3: write(): ERROR occured (errno=%d)",errno) ; END_TRACE() ; return -1 ; } rfilefdt[ctrl_sock_index]->byte_written_to_network += size; END_TRACE(); return(size); } /* Close part */ /* * remote file close */ int DLL_DECL rfio_close_v3(s) int s; { int req; char * p ; struct { unsigned int rcount; /* read() count */ unsigned int wcount; /* write() count */ unsigned int rbcount;/* byte(s) read */ unsigned int wbcount;/* byte(s) written */ } iostatbuf ; int rcode,status,status1,HsmType; struct timeval t; fd_set fdvar; unsigned char *dummy; int sizeofdummy = 128 * 1024; int n; char rfio_buf[BUFSIZ]; int s_index; int save_errno; INIT_TRACE("RFIO_TRACE"); TRACE(1, "rfio", "rfio_close_v3(%d)", s); /* * Check if file is Hsm. For CASTOR HSM files, the file is * closed using normal RFIO (local or remote) close(). */ HsmType = rfio_HsmIf_GetHsmType(s,NULL); if ( HsmType > 0 && HsmType != RFIO_HSM_CNS ) { status = rfio_HsmIf_close(s); END_TRACE(); return(status); } /* * The file is local */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1) { char r_token[CA_MAXDPMTOKENLEN+1]; char upath[CA_MAXHOSTNAMELEN+CA_MAXPATHLEN+2]; if ( HsmType == RFIO_HSM_CNS ) status1 = rfio_HsmIf_getipath(s,upath,r_token); TRACE(2, "rfio", "rfio_close_v3: using local close(%d)",s) ; status= close(s) ; save_errno = errno; #if defined (CLIENTLOG) /* Client logging */ rfio_logcl(s); #endif if ( HsmType == RFIO_HSM_CNS ) { if ( status1 == 1 ) status1 = rfio_HsmIf_reqtoput(upath,r_token); if ( status1 == 0 ) errno = save_errno; } else status1 = 0; END_TRACE() ; rfio_errno = 0; return (status ? status : status1) ; } /* * Checking mode 64. */ if (rfilefdt[s_index]->mode64) { status = rfio_close64_v3(s); END_TRACE() ; return(status); } #if defined (CLIENTLOG) /* Client logging */ rfio_logcl(s); #endif /* * Checking magic number */ if ( rfilefdt[s_index]->magic != RFIO_MAGIC ) { serrno = SEBADVERSION ; rfio_rfilefdt_freeentry(s_index); (void) close(s) ; END_TRACE(); return(-1); } /* * Sending request. */ p= rfio_buf ; marshall_WORD(p, RFIO_MAGIC); marshall_WORD(p, RQST_CLOSE_V3); marshall_LONG(p, rfilefdt[s_index]->byte_written_to_network); TRACE(2, "rfio", "rfio_close_v3: sending %d bytes",RQSTSIZE) ; if (netwrite_timeout(s, rfio_buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio", "rfio_close_v3: write(): ERROR occured (errno=%d)", errno); (void) rfio_cleanup_v3(s) ; END_TRACE() ; return -1 ; } while (1) { FD_ZERO(&fdvar); FD_SET(s,&fdvar); if ( rfilefdt[s_index]->lseekhow != INVALID_SOCKET ) FD_SET(rfilefdt[s_index]->lseekhow,&fdvar); t.tv_sec = 10; t.tv_usec = 0; TRACE(2,"rfio","close_v3: doing select") ; if (select(FD_SETSIZE,&fdvar,NULL,NULL,&t) < 0) { TRACE(2,"rfio","close_v3: select failed (errno=%d)",errno) ; (void) rfio_cleanup_v3(s) ; END_TRACE() ; return -1 ; } /* CLOSE confirmation received from server */ if (FD_ISSET(s,&fdvar)) { /* * Getting data from the network. */ TRACE(2, "rfio", "rfio_close: reading %d bytes",RQSTSIZE) ; if ((n = netread_timeout(s,rfio_buf,RQSTSIZE,RFIO_CTRL_TIMEOUT)) != RQSTSIZE) { if (n == 0) TRACE(2, "rfio", "rfio_close_v3: read(): ERROR occured (serrno=%d)", serrno); else TRACE(2, "rfio", "rfio_close_v3: read(): ERROR occured (errno=%d)", errno); (void)rfio_cleanup_v3(s) ; END_TRACE() ; return -1 ; } /* Closing data socket after the server has read all the data */ TRACE(2, "rfio", "rfio_close_v3 closing data socket, fildesc=%d",rfilefdt[s_index]->lseekhow) ; if (rfilefdt[s_index]->lseekhow != INVALID_SOCKET && s_close(rfilefdt[s_index]->lseekhow) < 0) TRACE(2, "rfio", "rfio_close_v3: close(): ERROR occured (errno=%d)", errno); rfilefdt[s_index]->lseekhow = INVALID_SOCKET; p = rfio_buf ; unmarshall_WORD(p,req) ; unmarshall_LONG(p,status) ; unmarshall_LONG(p, rcode) ; rfio_errno = rcode ; switch(req) { case RQST_CLOSE_V3: status1 = rfio_cleanup_v3(s) ; TRACE(1, "rfio", "rfio_close_v3: return status=%d, rcode=%d",status,rcode) ; END_TRACE() ; return (status ? status : status1) ; case REP_ERROR: /* It is possible to receive an error reply from the server write_v3 routine */ /* This is a bug fix for the internal rfio error returned by close_v3 when write_v3 on the server side returns 'not enough space' while the client has executing the close_v3 routine */ (void) rfio_cleanup_v3(s) ; TRACE(1, "rfio", "rfio_close_v3: return status=%d, rcode=%d",status,rcode) ; if ( status < 0 ) rfio_HsmIf_IOError(s,rcode); END_TRACE() ; return status ; case REP_EOF: /* If we read exactly the amount of data in the file */ TRACE(1, "rfio", "rfio_close_v3: received REP_EOF at close."); continue; default: TRACE(1,"rfio","rfio_close_v3(): Bad control word received") ; serrno= SEINTERNAL ; (void) rfio_cleanup_v3(s) ; END_TRACE() ; return -1 ; } } /* Server is still sending data through data socket */ /* Reading data socket to unstuck the server which then will be able to handle the CLOSE request we have sent previously */ if (FD_ISSET(rfilefdt[s_index]->lseekhow,&fdvar)) { TRACE(2, "rfio", "rfio_close_v3: emptying data socket") ; dummy = (unsigned char *)malloc(sizeof(unsigned char) * sizeofdummy); if (dummy == NULL) { TRACE(2,"rfio","rfio_close_v3(): Cannot allocate memory") ; (void) rfio_cleanup_v3(s) ; END_TRACE() ; return -1 ; } /* Do not use read here as NT doesn't support this with socket fds */ if ((n = s_nrecv(rfilefdt[s_index]->lseekhow, dummy, sizeofdummy)) <= 0) { if (n < 0) /* 0 = continue (data socket closed, waiting for close ack */ { TRACE(2,"rfio","close_v3: read failed (errno=%d)",errno) ; (void) rfio_cleanup_v3(s) ; END_TRACE() ; return -1 ; } else TRACE(2, "rfio", "rfio_close_v3: emptying data socket, %d bytes read from data socket",n) ; } free(dummy); } } } /* * lseek for RFIO version 3 transfers * Must be called only between an open (version 3) * and the first read or write system call */ int rfio_lseek_v3(s, offset, how) int s; int offset; int how; { char *p; char rfio_buf[BUFSIZ]; int rep; int status,rcode; int s_index; INIT_TRACE("RFIO_TRACE") ; TRACE(1, "rfio", "rfio_lseek_v3(%d,%d,%x)",s,offset,how); #if defined(CLIENTLOG) /* Client logging */ rfio_logls(s,offset,how); #endif /* CLIENTLOG */ /* * The file is local */ if ((s_index = rfio_rfilefdt_findentry(s,FINDRFILE_WITHOUT_SCAN)) == -1) { TRACE(2, "rfio", "rfio_lseek_v3: using local lseek(%d,%d,%d)",s,offset,how) ; status = lseek(s,offset,how); rfio_errno = 0; END_TRACE(); return status; } /* * Checking 'how' parameter. */ if (how != SEEK_SET) { errno = EINVAL; END_TRACE(); return -1; } /* * Checking magic number */ if (rfilefdt[s_index]->magic != RFIO_MAGIC) { serrno = SEBADVERSION; rfio_rfilefdt_freeentry(s_index); (void) close(s); END_TRACE(); return -1; } /* * Checking mode 64. */ if (rfilefdt[s_index]->mode64) { status = rfio_lseek64_v3(s, offset,how); END_TRACE(); return(status); } /* * Sending request. */ p = rfio_buf; marshall_WORD(p,RFIO_MAGIC); marshall_WORD(p,RQST_LSEEK_V3); marshall_LONG(p,offset); marshall_LONG(p,how); TRACE(2, "rfio", "rfio_lseek_v3: sending %d bytes",RQSTSIZE); if (netwrite_timeout(s,rfio_buf,RQSTSIZE,RFIO_CTRL_TIMEOUT) != RQSTSIZE) { TRACE(2, "rfio", "rfio_lseek_v3: write(): ERROR occured (errno=%d)", errno); END_TRACE(); return -1; } /* * Receiving reply * */ TRACE(2, "rfio", "rfio_lseek_v3: reading %d bytes",RQSTSIZE); if (netread_timeout(s,rfio_buf,WORDSIZE+2*LONGSIZE,RFIO_DATA_TIMEOUT) != WORDSIZE+2*LONGSIZE) { TRACE(2,"rfio","rfio_lseek_v3: read(): ERROR occured (errno=%d)",errno); END_TRACE(); return -1; } p = rfio_buf; unmarshall_WORD(p,rep); unmarshall_LONG(p,status); unmarshall_LONG(p,rcode); if (rep != RQST_LSEEK_V3) { TRACE(1,"rfio","rfio_lseek_v3(): Bad control word received\n"); serrno = SEINTERNAL; END_TRACE(); return -1; } if (status < 0) rfio_errno = rcode; TRACE(1,"rfio","rfio_lseek_v3: rep %x, status %d, rcode %d",rep,status,rcode) ; END_TRACE(); return status; } extern char *getconfent(); extern char *getenv(); /* get environmental variable value */ static int lasthost_key = -1; /* key to hold the last connect host name in TLS */ int data_rfio_connect(to,tolen,node,remote,flags) /* connect to data port on server */ struct sockaddr *to; /* address of data port on server */ int tolen; /* address length */ char *node; /* name of server host */ int *remote ; /* connected host is remote or not */ int flags; { register int s; /* socket descriptor */ char *p; /* character string pointer */ #ifndef _WIN32 #if defined(_REENTRANT) || defined(_THREAD_SAFE) char *last = NULL; #endif #endif register int retrycnt; /* number of NOMORERFIO retries */ register int retryint; /* interval between NOMORERFIO retries*/ register int crtycnt = 0; /* connect retry count */ register int crtyint = 0; /* connect retry interval */ register int crtyattmpt = 0; /* connect retry attempts done */ register int crtycnts = 0 ; struct stat statbuf ; /* NOMORERFIO stat buffer */ char nomorebuf1[BUFSIZ], nomorebuf2[BUFSIZ]; /* NOMORERFIO buffers */ int setsock_ceiling = 1 * 1024 * 1024; int max_rcvbuf; int max_sndbuf; int i; int port; char *lasthost = NULL; int lasthost_len = 256; #if !defined(_WIN32) int optlen,maxseg; #endif /* int max_rcvlow; */ INIT_TRACE("RFIO_TRACE"); /* * Under some circumstances the server fails * to accept a connection. A simple retry mechanism is therefore * implemented here. */ if ( rfioreadopt(RFIO_NETRETRYOPT) != RFIO_NOTIME2RETRY ) { if ((p = getconfent("RFIO", "CONRETRY", 0)) != NULL) { if ((crtycnt = atoi(p)) <= 0) { crtycnt = 0; } } serrno = 0 ; if ((p = getconfent("RFIO", "CONRETRYINT", 0)) != NULL) { if ((crtyint = atoi(p)) <= 0) { crtyint = 0; } } } crtycnts = crtycnt ; /* * When the NOMORERFIO file exists, or if NOMORERFIO.host file exists, * the RFIO service is suspended. By default it will retry for ever every * DEFRETRYINT seconds. */ if ((p=getconfent("RFIO", "RETRY", 0)) == NULL) { retrycnt=DEFRETRYCNT; } else { retrycnt=atoi(p); } if ((p=getconfent("RFIO", "RETRYINT", 0)) == NULL) { retryint=DEFRETRYINT; } else { retryint=atoi(p); } serrno = 0; /* reset the errno could be SEENTRYNFND */ rfio_errno = 0; switch(to->sa_family) { case AF_INET: port = ntohs(((struct sockaddr_in *)to)->sin_port); break; case AF_INET6: port = ntohs(((struct sockaddr_in6 *)to)->sin6_port); break; default: port = -1; break; } TRACE(1, "rfio", "datarfio_connect: connecting(%s) using port %d",node,port); #if defined(_WIN32) if (strncmp (NOMORERFIO, "%SystemRoot%\\", 13) == 0 && (p = getenv ("SystemRoot"))) sprintf (nomorebuf1, "%s%s", p, strchr (NOMORERFIO, '\\')); #else strcpy(nomorebuf1, NOMORERFIO); #endif sprintf(nomorebuf2, "%s.%s", nomorebuf1, node); retry: if (!stat(nomorebuf1,&statbuf)) { if (retrycnt-- >=0) { syslog(LOG_ALERT, "rfio: dataconnect: all RFIO service suspended (pid=%d)\n", getpid()); sleep(retryint); goto retry; } else { syslog(LOG_ALERT, "rfio: dataconnect: all RFIO service suspended (pid=%d), retries exhausted\n", getpid()); serrno=SERTYEXHAUST; END_TRACE(); return(-1); } } if (!stat(nomorebuf2, &statbuf)) { if (retrycnt-- >=0) { syslog(LOG_ALERT, "rfio: dataconnect: RFIO service to <%s> suspended (pid=%d)\n", node, getpid()); sleep(retryint); goto retry; } else { syslog(LOG_ALERT, "rfio: dataconnect: RFIO service to <%s> suspended (pid=%d), retries exhausted\n", node, getpid()); serrno=SERTYEXHAUST; END_TRACE(); return(-1); } } conretry: TRACE(2, "rfio", "rfio_dataconnect: socket(%d, %d, %d)", to->sa_family, SOCK_STREAM, 0); if ((s = socket(to->sa_family, SOCK_STREAM, 0)) < 0) { TRACE(2, "rfio", "datarfio_connect: socket(): ERROR occured (errno=%d)", errno); END_TRACE(); return(-1); } max_rcvbuf = setsock_ceiling; max_sndbuf = setsock_ceiling; /* A bit ugly but this is the only solution because the posix flag O_ACCMODE is not defined under NT with MS C++ compiler */ #if defined(_WIN32) #ifndef O_ACCMODE #define O_ACCMODE 3 #endif #endif /* Do the RCV_BUF setsockopt only if we are reading a file */ /* This is a fix for observed performance problems */ /* between DECs and SGIs using HIPPI */ if ((flags & O_ACCMODE) == O_RDONLY) { for (i = setsock_ceiling ; i >= 16 * 1024 ; i >>= 1) { if (set_rcv_sockparam(s,i) == i) { max_rcvbuf = i; break; } } TRACE(2,"rfio","setsockopt maxrcv=%d",max_rcvbuf); } /* Do the SND_BUF setsockopt only if we are writing to a file */ /* This is a fix for observed performance problems */ /* between DECs and SGIs using HIPPI */ if ((flags & O_ACCMODE) == O_WRONLY) { for (i = setsock_ceiling ; i >= 16 * 1024 ; i >>= 1) { if (set_snd_sockparam(s,i) == i) { max_sndbuf = i; break; } } TRACE(2,"rfio","setsockopt maxsnd=%d",max_sndbuf); } TRACE(2, "rfio", "rfio_dataconnect: connect(%d, %x, %d)", s, to, tolen); if (connect(s, to, tolen) < 0) { TRACE(2, "rfio", "rfio_dataconnect: connect(): ERROR occured (errno=%d)", errno); #if defined(_WIN32) if (errno == WSAECONNREFUSED) #else if (errno == ECONNREFUSED) #endif { syslog(LOG_ALERT, "rfio: dataconnect: %d failed to connect %s", getpid(), node); if (crtycnt-- > 0) { if (crtyint) sleep(crtyint); syslog(LOG_ALERT, "rfio: dataconnect: %d retrying to connect %s", getpid(), node); /* * connect() returns "Invalid argument when called twice, * so socket needs to be closed and recreated first */ (void) close(s); crtyattmpt ++ ; goto conretry; } } (void) close(s); END_TRACE(); return(-1); } if (crtyattmpt) { syslog(LOG_ALERT, "rfio: dataconnect: %d recovered connection after %d secs with %s",getpid(), crtyattmpt*crtyint,node) ; } { int sav_serrno = serrno; *remote = isremote_sa( to, node ) ; serrno = sav_serrno; /* Failure or not of isremote(), we continue */ } Cglobals_get(&lasthost_key, (void**)&lasthost, lasthost_len); strcpy(lasthost, node); /* remember to fetch back remote errs */ TRACE(2, "rfio", "rfio_dataconnect: connected"); TRACE(2, "rfio", "rfio_dataconnect: calling setnetio(%d)", s); if (setnetio(s) < 0) { close(s); END_TRACE(); return(-1); } TRACE(1, "rfio", "rfio_dataconnect: return socket %d", s); END_TRACE(); return(s); } static int set_rcv_sockparam(s,value) int s,value; { if (setsockopt(s,SOL_SOCKET,SO_RCVBUF,(char *)&value, sizeof(value)) < 0) { #if defined(_WIN32) if (errno != WSAENOBUFS) #else if (errno != ENOBUFS) #endif { TRACE(2,"rfio", "setsockopt rcvbuf(): %s\n",strerror(errno)); return(-1); } else return(-1); } /* else */ return(value); } static int set_snd_sockparam(s,value) int s,value; { if (setsockopt(s,SOL_SOCKET,SO_SNDBUF,(char *)&value, sizeof(value)) < 0) { #if defined(_WIN32) if (errno != WSAENOBUFS) #else if (errno != ENOBUFS) #endif { TRACE(2,"rfio", "setsockopt sndbuf(): %s\n",strerror(errno)); return(-1); } else return(-1); } /* else */ return(value); } lcgdm-1.10.0/setosflags0000755000175000017500000000270210742633772014333 0ustar ellertellert#!/bin/sh # # Copyright (C) 1996-2008 by CERN/IT/PDP/DM # All rights reserved # # @(#)$RCSfile: setosflags,v $ $Revision: 1.4 $ $Date: 2008/01/14 10:22:50 $ CERN IT-PDP/DM Jean-Philippe Baud # set BOOTSTRAPCFLAGS, OSMAJNO and OSMINNO automatically # sysname=`uname -s` sysrel=`uname -r` case $sysname in AIX) OSMAJNO=`uname -v` OSMINNO=$sysrel ;; Darwin) OSMAJNO=`sw_vers -productVersion | cut -d'.' -f1` OSMINNO=`sw_vers -productVersion | cut -d'.' -f2` ;; HP-UX) OSMAJNO=`echo $sysrel | awk '{ print int(substr($1,3,2))}'` OSMINNO=`echo $sysrel | awk '{ print int(substr($1,6,2))}'` if [ $OSMAJNO -ge 10 ] then BOOTSTRAPCFLAGS="-DHPUX10" fi;; IRIX | IRIX64) OSMAJNO=`echo $sysrel | awk '{ print substr($1,1,1)}'` OSMINNO=`echo $sysrel | awk '{ print substr($1,3)}'` if [ $OSMAJNO -ge 5 ] then BOOTSTRAPCFLAGS="-DIRIX5" fi;; SunOS) OSMAJNO=`echo $sysrel | awk '{ print substr($1,1,1)}'` OSMINNO=`echo $sysrel | awk '{ print int(substr($1,3))}'` if [ $OSMAJNO -eq 5 ] then BOOTSTRAPCFLAGS="-DSOLARIS" fi;; OSF1) OSMAJNO=`echo $sysrel | awk '{ print substr($1,2,1)}'` OSMINNO=`echo $sysrel | awk '{ print substr($1,4)}'` ;; Linux) OSMAJNO=`echo $sysrel | awk '{ print substr($1,1,1)}'` OSMINNO=`echo $sysrel | awk '{ print substr($1,3)}'` ;; LynxOS) OSMAJNO=`echo $sysrel | awk '{ print substr($1,1,1)}'` OSMINNO=`echo $sysrel | awk '{ print substr($1,3)}'` ;; esac export BOOTSTRAPCFLAGS OSMAJNO OSMINNO lcgdm-1.10.0/imake/0000755000175000017500000000000013234072376013314 5ustar ellertellertlcgdm-1.10.0/imake/Makefile.ini.Win320000644000175000017500000000172007752722175016442 0ustar ellertellert# # WARNING WARNING WARNING WARNING WARNING WARNING WARNING # # This is NOT an automatically generated Makefile! It is hand-crafted as a # bootstrap, may need editing for your system. The BOOTSTRAPCFLAGS variable # may be given at the top of the build tree for systems that do not define # any machine-specific preprocessor symbols. # BOOTSTRAPCFLAGS = CDEBUGFLAGS = -O INCLUDES = -I../include CFLAGS = $(BOOTSTRAPCFLAGS) $(CDEBUGFLAGS) $(INCLUDES) SHELL = cmd RM = del MAKE = nmake /nologo NPROC = 1 imake.exe:: @echo making imake with BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS) imake.exe:: imake.obj cl /nologo imake.obj imake.obj: imake.c cl /nologo -c $(CFLAGS) imake.c relink: if exist imake.exe $(RM) imake.exe $(MAKE) $(MFLAGS) imake.exe clean: if exist imake.obj $(RM) imake.obj if exist imake.exe $(RM) imake.exe clobber: clean depend: # for manual use Makefile: imake imake -DNEWTOP=../ tags: install: install.man: Makefiles: lcgdm-1.10.0/imake/Makefile.ini0000644000175000017500000000232607752722175015544 0ustar ellertellert# # WARNING WARNING WARNING WARNING WARNING WARNING WARNING # # This is NOT an automatically generated Makefile! It is hand-crafted as a # bootstrap, may need editing for your system. The BOOTSTRAPCFLAGS variable # may be given at the top of the build tree for systems that do not define # any machine-specific preprocessor symbols. # BOOTSTRAPCFLAGS = CDEBUGFLAGS = -O INCLUDES = -I../include CFLAGS = $(BOOTSTRAPCFLAGS) $(CDEBUGFLAGS) $(INCLUDES) SHELL = /bin/sh RM = rm -f MAKE = make RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \ tags TAGS make.log NPROC = 1 imake:: @echo "making imake with BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS)" imake:: imake.o $(CC) -o imake imake.o imake.o: ccimake imake.c $(CC) -c $(CFLAGS) `./ccimake` imake.c ccimake: ccimake.c $(CC) -o ccimake $(CFLAGS) ccimake.c relink: $(RM) imake $(MAKE) $(MFLAGS) imake clean: $(RM) ccimake imake.o imake $(RM_CMD) \#* clobber: clean depend: # for manual use Makefile: imake imake -DNEWTOP=../ tags: install: install.man: Makefiles: imake.exe: imake.obj cl -nologo imake.obj imake.obj: imake.c cl -nologo -c $(CFLAGS) imake.c lcgdm-1.10.0/imake/ccimake.c0000644000175000017500000000110310724001747015042 0ustar ellertellert/* * $XConsortium: ccimake.c,v 1.12 89/10/16 12:09:23 jim Exp $ * * Warning: This file must be kept as simple as posible so that it can * compile without any special flags on all systems. Do not touch it unless * you *really* know what you're doing. Make changes in imakemdep.h, not here. */ #define CCIMAKE /* only get imake_ccflags definitions */ #include "imakemdep.h" /* things to set when porting imake */ #include #ifndef imake_ccflags #define imake_ccflags "-O" #endif main() { write(1, imake_ccflags, sizeof(imake_ccflags) - 1); exit(0); } lcgdm-1.10.0/imake/imake.c0000644000175000017500000005104710724001747014550 0ustar ellertellert/*****************************************************************************\ * * * Porting Note * * * * Add the value of BOOTSTRAPCFLAGS to the cpp_argv table so that it will be * * passed to the template file. * * * \*****************************************************************************/ /* * * Copyright 1985, 1986, 1987 by the Massachusetts Institute of Technology * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without * fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright * notice and this permission notice appear in supporting * documentation, and that the name of M.I.T. not be used in * advertising or publicity pertaining to distribution of the * software without specific, written prior permission. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" * without express or implied warranty. * * $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $ * * * Author: * Todd Brunhoff * Tektronix, inc. * While a guest engineer at Project Athena, MIT * * imake: the include-make program. * * Usage: imake [-Idir] [-Ddefine] [-T] [-f imakefile ] [-s] [-e] [-v] [make flags] * * Imake takes a template makefile (Imake.tmpl) and runs cpp on it * producing a temporary makefile in /tmp. It then runs make on * this pre-processed makefile. * Options: * -D define. Same as cpp -D argument. * -I Include directory. Same as cpp -I argument. * -T template. Designate a template other * than Imake.tmpl * -s[F] show. Show the produced makefile on the standard * output. Make is not run is this case. If a file * argument is provided, the output is placed there. * -e[F] execute instead of show; optionally name Makefile F * -v verbose. Show the make command line executed. * * Environment variables: * * IMAKEINCLUDE Include directory to use in addition to "." * IMAKECPP Cpp to use instead of /lib/cpp * IMAKEMAKE make program to use other than what is * found by searching the $PATH variable. * Other features: * imake reads the entire cpp output into memory and then scans it * for occurences of "@@". If it encounters them, it replaces it with * a newline. It also trims any trailing white space on output lines * (because make gets upset at them). This helps when cpp expands * multi-line macros but you want them to appear on multiple lines. * * The macros MAKEFILE and MAKE are provided as macros * to make. MAKEFILE is set to imake's makefile (not the constructed, * preprocessed one) and MAKE is set to argv[0], i.e. the name of * the imake program. * * Theory of operation: * 1. Determine the name of the imakefile from the command line (-f) * or from the content of the current directory (Imakefile or imakefile). * Call this . This gets added to the arguments for * make as MAKEFILE=. * 2. Determine the name of the template from the command line (-T) * or the default, Imake.tmpl. Call this