Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sfs.cc File Reference
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/time.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
#include <dlfcn.h>
#include <sys/ipc.h>
#include <pthread.h>
#include <strings.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netdb.h>
#include <sys/wait.h>
#include <sys/resource.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <iostream>
#include <iomanip>
+ Include dependency graph for sfs.cc:

Go to the source code of this file.

Classes

struct  bufferstructure
 

Macros

#define BUFFERBLOCKSIZE   8192U
 
#define CTRL_BEGINRUN   1
 
#define CTRL_ENDRUN   2
 
#define CTRL_DATA   3
 
#define CTRL_CLOSE   4
 
#define CTRL_SENDFILENAME   5
 
#define CTRL_ROLLOVER   6
 
#define CTRL_REMOTESUCCESS   100
 
#define CTRL_REMOTEFAIL   101
 
#define ROLE_RECEIVED   0
 
#define ROLE_WRITTEN   1
 
#define INITIAL_SIZE   (4*1024*1024)
 

Typedefs

typedef unsigned int PHDWORD
 
typedef unsigned short SWORD
 
typedef unsigned char BYTE
 
typedef unsigned int UINT
 

Functions

int readn (int, char *, int)
 
int writen (int, char *, int)
 
void sig_handler (...)
 
void * writebuffers (void *arg)
 
int handle_this_child (pid_t pid, const std::string &host)
 
in_addr_t find_address_from_interface (const char *)
 
void cleanup (const int exitstatus)
 
void exitmsg ()
 
int main (int argc, char *argv[])
 

Variables

int run_number = 0
 
int verbose = 0
 
int sockfd = 0
 
int dd_fd = 0
 
pthread_mutex_t M_cout
 
pthread_mutex_t M_write
 
pthread_mutex_t M_done
 
pthread_t ThreadId
 
pthread_t tid
 
int output_fd = -1
 
int the_port = 5001
 
int do_not_write = 0
 
int RunIsActive = 0
 
int NumberWritten = 0
 
int file_open = 0
 
bufferstructurebf_being_received
 
bufferstructurebf_being_written
 
std::string listen_interface
 

Macro Definition Documentation

#define BUFFERBLOCKSIZE   8192U

Definition at line 61 of file sfs.cc.

View newest version in sPHENIX GitHub at line 61 of file sfs.cc

#define CTRL_BEGINRUN   1

Definition at line 64 of file sfs.cc.

View newest version in sPHENIX GitHub at line 64 of file sfs.cc

Referenced by handle_this_child().

#define CTRL_CLOSE   4

Definition at line 67 of file sfs.cc.

View newest version in sPHENIX GitHub at line 67 of file sfs.cc

Referenced by handle_this_child().

#define CTRL_DATA   3

Definition at line 66 of file sfs.cc.

View newest version in sPHENIX GitHub at line 66 of file sfs.cc

Referenced by handle_this_child().

#define CTRL_ENDRUN   2

Definition at line 65 of file sfs.cc.

View newest version in sPHENIX GitHub at line 65 of file sfs.cc

Referenced by handle_this_child().

#define CTRL_REMOTEFAIL   101

Definition at line 72 of file sfs.cc.

View newest version in sPHENIX GitHub at line 72 of file sfs.cc

Referenced by handle_this_child().

#define CTRL_REMOTESUCCESS   100

Definition at line 71 of file sfs.cc.

View newest version in sPHENIX GitHub at line 71 of file sfs.cc

Referenced by handle_this_child().

#define CTRL_ROLLOVER   6

Definition at line 69 of file sfs.cc.

View newest version in sPHENIX GitHub at line 69 of file sfs.cc

Referenced by handle_this_child().

#define CTRL_SENDFILENAME   5

Definition at line 68 of file sfs.cc.

View newest version in sPHENIX GitHub at line 68 of file sfs.cc

Referenced by handle_this_child().

#define INITIAL_SIZE   (4*1024*1024)

Definition at line 80 of file sfs.cc.

View newest version in sPHENIX GitHub at line 80 of file sfs.cc

Referenced by handle_this_child().

#define ROLE_RECEIVED   0

Definition at line 74 of file sfs.cc.

View newest version in sPHENIX GitHub at line 74 of file sfs.cc

Referenced by handle_this_child().

#define ROLE_WRITTEN   1

Definition at line 75 of file sfs.cc.

View newest version in sPHENIX GitHub at line 75 of file sfs.cc

Referenced by handle_this_child().

Typedef Documentation

typedef unsigned char BYTE

Definition at line 58 of file sfs.cc.

View newest version in sPHENIX GitHub at line 58 of file sfs.cc

typedef unsigned int PHDWORD

Definition at line 56 of file sfs.cc.

View newest version in sPHENIX GitHub at line 56 of file sfs.cc

typedef unsigned short SWORD

Definition at line 57 of file sfs.cc.

View newest version in sPHENIX GitHub at line 57 of file sfs.cc

typedef unsigned int UINT

Definition at line 59 of file sfs.cc.

View newest version in sPHENIX GitHub at line 59 of file sfs.cc

Function Documentation

void cleanup ( const int  exitstatus)

Definition at line 740 of file sfs.cc.

View newest version in sPHENIX GitHub at line 740 of file sfs.cc

References dd_fd.

void exitmsg ( )

Definition at line 140 of file sfs.cc.

View newest version in sPHENIX GitHub at line 140 of file sfs.cc

in_addr_t find_address_from_interface ( const char *  interface)

Definition at line 709 of file sfs.cc.

View newest version in sPHENIX GitHub at line 709 of file sfs.cc

References KFPMath::a, fd, and verbose.

Referenced by main().

+ Here is the caller graph for this function:

int handle_this_child ( pid_t  pid,
const std::string &  host 
)

Definition at line 327 of file sfs.cc.

View newest version in sPHENIX GitHub at line 327 of file sfs.cc

References bufferstructure::bf, bf_being_received, bf_being_written, bufferstructure::buffersize, bufferstructure::bytecount, cleanup(), CTRL_BEGINRUN, CTRL_CLOSE, CTRL_DATA, CTRL_ENDRUN, CTRL_REMOTEFAIL, CTRL_REMOTESUCCESS, CTRL_ROLLOVER, CTRL_SENDFILENAME, dd_fd, bufferstructure::dirty, do_not_write, filename, go_on, i, INITIAL_SIZE, M_cout, M_done, M_write, Acts::open, output_fd, merge_hashes::p, readn(), bufferstructure::role, ROLE_RECEIVED, ROLE_WRITTEN, utils::status, ThreadId, Acts::Test::time, value, verbose, writebuffers(), and writen().

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int main ( int  argc,
char *  argv[] 
)

Definition at line 167 of file sfs.cc.

View newest version in sPHENIX GitHub at line 167 of file sfs.cc

References Acts::PhysicalConstants::c, cleanup(), dd_fd, do_not_write, exitmsg(), find_address_from_interface(), h, handle_this_child(), i, listen_interface, M_cout, M_done, M_write, out, train_ambiguity_solver::pid, physmon_simulation::s, signal(), sockfd, the_port, Acts::Test::time, and verbose.

+ Here is the call graph for this function:

int readn ( int  fd,
char *  ptr,
int  nbytes 
)

Definition at line 657 of file sfs.cc.

View newest version in sPHENIX GitHub at line 657 of file sfs.cc

References i, and ActsExamples::JsonSurfacesReader::read().

Referenced by handle_this_child(), rcdaqEventiterator::read_next_buffer(), sendMonitorData(), daqBuffer::sendout(), server_send_beginrun_sequence(), server_send_endrun_sequence(), and server_send_rollover_sequence().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void sig_handler (   ...)

Definition at line 244 of file changehitformat.cc.

View newest version in sPHENIX GitHub at line 244 of file changehitformat.cc

References COUT, and it.

Referenced by main().

+ Here is the caller graph for this function:

void* writebuffers ( void *  arg)

Definition at line 777 of file rcdaq.cc.

View newest version in sPHENIX GitHub at line 777 of file rcdaq.cc

References BytesInThisFile, BytesInThisRun, daq_open_flag, daq_server_flag, end_thread, last_bufferwritetime, NumberWritten, outfile_fd, daqBuffer::sendout(), TheServerFD, Acts::Test::time, transportBuffer, daqBuffer::writeout(), WriteProtectSem, and WriteSem.

+ Here is the call graph for this function:

int writen ( int  fd,
char *  ptr,
int  nbytes 
)

Definition at line 692 of file sfs.cc.

View newest version in sPHENIX GitHub at line 692 of file sfs.cc

References write().

Referenced by handle_this_child(), rcdaqEventiterator::read_next_buffer(), daqBuffer::sendData(), daqBuffer::sendout(), server_send_beginrun_sequence(), server_send_close_sequence(), server_send_endrun_sequence(), server_send_rollover_sequence(), prdfoStream::writeout(), and daqBuffer::writeout().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

bufferstructure* bf_being_received

Definition at line 133 of file sfs.cc.

View newest version in sPHENIX GitHub at line 133 of file sfs.cc

Referenced by handle_this_child().

bufferstructure* bf_being_written

Definition at line 134 of file sfs.cc.

View newest version in sPHENIX GitHub at line 134 of file sfs.cc

Referenced by handle_this_child().

int dd_fd = 0

Definition at line 95 of file sfs.cc.

View newest version in sPHENIX GitHub at line 95 of file sfs.cc

Referenced by cleanup(), handle_this_child(), main(), and monitorRequestwatcher_thread().

int do_not_write = 0

Definition at line 110 of file sfs.cc.

View newest version in sPHENIX GitHub at line 110 of file sfs.cc

Referenced by handle_this_child(), and main().

int file_open = 0

Definition at line 114 of file sfs.cc.

View newest version in sPHENIX GitHub at line 114 of file sfs.cc

std::string listen_interface

Definition at line 165 of file sfs.cc.

View newest version in sPHENIX GitHub at line 165 of file sfs.cc

Referenced by main().

pthread_mutex_t M_cout

Definition at line 98 of file sfs.cc.

View newest version in sPHENIX GitHub at line 98 of file sfs.cc

pthread_mutex_t M_done

Definition at line 101 of file sfs.cc.

View newest version in sPHENIX GitHub at line 101 of file sfs.cc

Referenced by handle_this_child(), and main().

pthread_mutex_t M_write

Definition at line 100 of file sfs.cc.

View newest version in sPHENIX GitHub at line 100 of file sfs.cc

Referenced by handle_this_child(), and main().

int NumberWritten = 0

Definition at line 113 of file sfs.cc.

View newest version in sPHENIX GitHub at line 113 of file sfs.cc

int output_fd = -1

Definition at line 106 of file sfs.cc.

View newest version in sPHENIX GitHub at line 106 of file sfs.cc

Referenced by handle_this_child().

int run_number = 0

Definition at line 92 of file sfs.cc.

View newest version in sPHENIX GitHub at line 92 of file sfs.cc

Referenced by Fun4AllPrdfOutputManager::InitPrdfManager(), open_file(), open_file_on_server(), plot(), and testEventiterator::testEventiterator().

int RunIsActive = 0

Definition at line 112 of file sfs.cc.

View newest version in sPHENIX GitHub at line 112 of file sfs.cc

int sockfd = 0

Definition at line 94 of file sfs.cc.

View newest version in sPHENIX GitHub at line 94 of file sfs.cc

Referenced by main(), monitorRequestwatcher_thread(), and open_serverSocket().

int the_port = 5001

Definition at line 108 of file sfs.cc.

View newest version in sPHENIX GitHub at line 108 of file sfs.cc

Referenced by main().

pthread_t ThreadId

Definition at line 104 of file sfs.cc.

View newest version in sPHENIX GitHub at line 104 of file sfs.cc

pthread_t tid

Definition at line 105 of file sfs.cc.

View newest version in sPHENIX GitHub at line 105 of file sfs.cc

Referenced by TrackingPerformanceCheck::process_event().

int verbose = 0

Definition at line 93 of file sfs.cc.

View newest version in sPHENIX GitHub at line 93 of file sfs.cc