MIDAS
|
Classes | |
struct | FL_PARAM |
struct | suspend_struct |
Macros | |
#define | bin_to_ascii(c) ((c)>=38?((c)-38+'a'):(c)>=12?((c)-12+'A'):(c)+'.') |
#define | N_STACK_HISTORY 500 |
Typedefs | |
typedef struct suspend_struct | SUSPEND_STRUCT |
Functions | |
static void | check_shm_type (const char *shm_type) |
static void | check_shm_host () |
static int | ss_shm_name (const char *name, std::string &mem_name, std::string &file_name, std::string &shm_name) |
INT | ss_shm_open (const char *name, INT size, void **adr, size_t *shm_size, HNDLE *handle, BOOL get_size) |
INT | ss_shm_close (const char *name, void *adr, size_t shm_size, HNDLE handle, INT destroy_flag) |
INT | ss_shm_delete (const char *name) |
INT | ss_shm_protect (HNDLE handle, void *adr, size_t shm_size) |
INT | ss_shm_unprotect (HNDLE handle, void **adr, size_t shm_size, BOOL read, BOOL write, const char *caller_name) |
INT | ss_shm_flush_thread (void *p) |
INT | ss_shm_flush (const char *name, const void *adr, size_t size, HNDLE handle, bool wait_for_thread) |
INT | ss_get_struct_align () |
INT | ss_get_struct_padding () |
INT | ss_getpid (void) |
BOOL | ss_pid_exists (int pid) |
void | ss_kill (int pid) |
midas_thread_t | ss_gettid (void) |
std::string | ss_tid_to_string (midas_thread_t thread_id) |
INT | ss_spawnv (INT mode, const char *cmdname, const char *const argv[]) |
INT | ss_shell (int sock) |
INT | ss_daemon_init (BOOL keep_stdout) |
BOOL | ss_existpid (INT pid) |
INT | ss_system (const char *command) |
INT | ss_exec (const char *command, INT *pid) |
std::string | ss_replace_env_variables (const std::string &inputPath) |
std::string | ss_execs (const char *cmd) |
midas_thread_t | ss_thread_create (INT(*thread_func)(void *), void *param) |
INT | ss_thread_kill (midas_thread_t thread_id) |
INT EXPRT | ss_thread_set_name (std::string name) |
std::string EXPRT | ss_thread_get_name () |
INT | ss_semaphore_create (const char *name, HNDLE *semaphore_handle) |
INT | ss_semaphore_wait_for (HNDLE semaphore_handle, INT timeout) |
INT | ss_semaphore_release (HNDLE semaphore_handle) |
INT | ss_semaphore_delete (HNDLE semaphore_handle, INT destroy_flag) |
INT | ss_mutex_create (MUTEX_T **mutex, BOOL recursive) |
INT | ss_mutex_wait_for (MUTEX_T *mutex, INT timeout) |
INT | ss_mutex_release (MUTEX_T *mutex) |
INT | ss_mutex_delete (MUTEX_T *mutex) |
bool | ss_timed_mutex_wait_for_sec (std::timed_mutex &mutex, const char *mutex_name, double timeout_sec) |
void | ss_tzset () |
time_t | ss_mktime (struct tm *tms) |
DWORD | ss_millitime () |
DWORD | ss_time () |
double | ss_time_sec () |
DWORD | ss_settime (DWORD seconds) |
std::string | ss_asctime () |
INT | ss_timezone () |
INT | ss_sleep (INT millisec) |
BOOL | ss_kbhit () |
INT | ss_alarm (INT millitime, void(*func)(int)) |
INT | ss_exception_handler (void(*func)(void)) |
void * | ss_ctrlc_handler (void(*func)(int)) |
static bool | ss_match_thread (midas_thread_t tid1, midas_thread_t tid2) |
INT | ss_suspend_set_rpc_thread (midas_thread_t thread_id) |
static INT | ss_suspend_init_struct (SUSPEND_STRUCT *psuspend) |
SUSPEND_STRUCT * | ss_suspend_get_struct (midas_thread_t thread_id) |
static void | ss_suspend_close (SUSPEND_STRUCT *psuspend) |
INT | ss_suspend_exit () |
INT | ss_suspend_set_server_listener (int listen_socket) |
INT | ss_suspend_set_client_listener (int listen_socket) |
INT | ss_suspend_set_client_connection (RPC_SERVER_CONNECTION *connection) |
INT | ss_suspend_set_server_acceptions (RPC_SERVER_ACCEPTION_LIST *acceptions) |
INT | ss_suspend_init_odb_port () |
INT | ss_suspend_get_odb_port (INT *port) |
INT | ss_suspend_get_buffer_port (midas_thread_t thread_id, INT *port) |
static int | ss_suspend_process_ipc (INT millisec, INT msg, int ipc_recv_socket) |
static int | ss_socket_check (int sock) |
bool | ss_event_socket_has_data () |
INT | ss_suspend (INT millisec, INT msg) |
INT | ss_resume (INT port, const char *message) |
int | ss_socket_wait (int sock, INT millisec) |
INT | ss_socket_connect_tcp (const char *hostname, int tcp_port, int *sockp, std::string *error_msg_p) |
INT | ss_socket_listen_tcp (bool listen_localhost, int tcp_port, int *sockp, int *tcp_port_p, std::string *error_msg_p) |
INT | ss_socket_close (int *sockp) |
INT | ss_socket_get_peer_name (int sock, std::string *hostp, int *portp) |
INT | send_tcp (int sock, char *buffer, DWORD buffer_size, INT flags) |
INT | ss_write_tcp (int sock, const char *buffer, size_t buffer_size) |
INT | recv_string (int sock, char *buffer, DWORD buffer_size, INT millisec) |
INT | recv_tcp (int sock, char *net_buffer, DWORD buffer_size, INT flags) |
INT | recv_tcp2 (int sock, char *net_buffer, int buffer_size, int timeout_ms) |
INT | ss_recv_net_command (int sock, DWORD *routine_id, DWORD *param_size, char **param_ptr, int timeout_ms) |
std::string | ss_gethostname () |
INT | ss_gethostname (char *buffer, int buffer_size) |
std::string | ss_getcwd () |
INT | ss_tape_open (char *path, INT oflag, INT *channel) |
INT | ss_tape_close (INT channel) |
INT | ss_tape_status (char *path) |
INT | ss_tape_write (INT channel, void *pdata, INT count) |
INT | ss_tape_read (INT channel, void *pdata, INT *count) |
INT | ss_tape_write_eof (INT channel) |
INT | ss_tape_fskip (INT channel, INT count) |
INT | ss_tape_rskip (INT channel, INT count) |
INT | ss_tape_rewind (INT channel) |
INT | ss_tape_spool (INT channel) |
INT | ss_tape_mount (INT channel) |
INT | ss_tape_unmount (INT channel) |
INT | ss_tape_get_blockn (INT channel) |
double | ss_disk_free (const char *path) |
INT | ss_file_find (const char *path, const char *pattern, char **plist) |
INT | ss_file_find (const char *path, const char *pattern, STRING_LIST *plist) |
INT | ss_dir_find (const char *path, const char *pattern, char **plist) |
INT | ss_dir_find (const char *path, const char *pattern, STRING_LIST *plist) |
INT | ss_dirlink_find (const char *path, const char *pattern, char **plist) |
INT | ss_dirlink_find (const char *path, const char *pattern, STRING_LIST *plist) |
INT | ss_file_remove (const char *path) |
double | ss_file_size (const char *path) |
time_t | ss_file_time (const char *path) |
double | ss_disk_size (const char *path) |
int | ss_file_exist (const char *path) |
int | ss_file_link_exist (const char *path) |
int | ss_dir_exist (const char *path) |
int | ss_file_copy (const char *src, const char *dst, bool append) |
void | ss_clear_screen () |
void | ss_set_screen_size (int x, int y) |
void | ss_printf (INT x, INT y, const char *format,...) |
char * | ss_getpass (const char *prompt) |
INT | ss_getchar (BOOL reset) |
char * | ss_gets (char *string, int size) |
INT | ss_directio_give_port (INT start, INT end) |
INT | ss_directio_lock_port (INT start, INT end) |
char * | ss_crypt (const char *buf, const char *salt) |
double | ss_nan () |
int | ss_isnan (double x) |
int | ss_isfin (double x) |
INT | ss_stack_get (char ***string) |
void | ss_stack_print () |
void | ss_stack_history_entry (char *tag) |
void | ss_stack_history_dump (char *filename) |
bool | ss_is_valid_utf8 (const char *string) |
bool | ss_repair_utf8 (char *string) |
bool | ss_repair_utf8 (std::string &s) |
std::chrono::time_point< std::chrono::high_resolution_clock > | ss_us_start () |
unsigned int | ss_us_since (std::chrono::time_point< std::chrono::high_resolution_clock > start) |
int | rpc_flush_event_socket (int timeout_msec) |
Variables | |
struct { | |
char c | |
double d | |
} | test_align |
struct { | |
double d | |
char c | |
} | test_padding |
static BOOL | _daemon_flag |
static std::atomic_bool | s_semaphore_trace {false} |
static std::atomic_int | s_semaphore_nest_level {0} |
static std::mutex | gTzMutex |
void(* | MidasExceptionHandler )(void) |
static std::vector< SUSPEND_STRUCT * > | _ss_suspend_vector |
static midas_thread_t | _ss_odb_thread = 0 |
static SUSPEND_STRUCT * | _ss_suspend_odb = NULL |
static midas_thread_t | _ss_listen_thread = 0 |
static int | _ss_server_listen_socket = 0 |
static int | _ss_client_listen_socket = 0 |
static midas_thread_t | _ss_client_thread = 0 |
static RPC_SERVER_CONNECTION * | _ss_client_connection = NULL |
static midas_thread_t | _ss_server_thread = 0 |
static RPC_SERVER_ACCEPTION_LIST * | _ss_server_acceptions = NULL |
static bool | gSocketTrace = false |
char | stack_history [N_STACK_HISTORY][80] |
int | stack_history_pointer = -1 |
dox
Definition at line 7828 of file system.cxx.
#define N_STACK_HISTORY 500 |
Definition at line 7929 of file system.cxx.
typedef struct suspend_struct SUSPEND_STRUCT |
|
static |
Definition at line 174 of file system.cxx.
|
static |
Definition at line 83 of file system.cxx.
Definition at line 5332 of file system.cxx.
Definition at line 5387 of file system.cxx.
Definition at line 5495 of file system.cxx.
int rpc_flush_event_socket | ( | int | timeout_msec | ) |
Definition at line 16103 of file midas.cxx.
Definition at line 5218 of file system.cxx.
Definition at line 3676 of file system.cxx.
std::string EXPRT ss_asctime | ( | ) |
Definition at line 3488 of file system.cxx.
void EXPRT ss_clear_screen | ( | ) |
Definition at line 7238 of file system.cxx.
char EXPRT * ss_crypt | ( | const char * | buf, |
const char * | salt | ||
) |
void EXPRT * ss_ctrlc_handler | ( | void(*)(int) | func | ) |
Definition at line 1972 of file system.cxx.
Definition at line 6735 of file system.cxx.
INT ss_dir_find | ( | const char * | path, |
const char * | pattern, | ||
STRING_LIST * | plist | ||
) |
Definition at line 6753 of file system.cxx.
Definition at line 7750 of file system.cxx.
Definition at line 7786 of file system.cxx.
Definition at line 6811 of file system.cxx.
INT ss_dirlink_find | ( | const char * | path, |
const char * | pattern, | ||
STRING_LIST * | plist | ||
) |
Definition at line 6829 of file system.cxx.
double EXPRT ss_disk_free | ( | const char * | path | ) |
Definition at line 6559 of file system.cxx.
double EXPRT ss_disk_size | ( | const char * | path | ) |
Definition at line 6987 of file system.cxx.
bool ss_event_socket_has_data | ( | ) |
Definition at line 4459 of file system.cxx.
INT ss_exception_handler | ( | void(*)(void) | func | ) |
Definition at line 3783 of file system.cxx.
Definition at line 2103 of file system.cxx.
std::string EXPRT ss_execs | ( | const char * | cmd | ) |
Definition at line 2039 of file system.cxx.
int EXPRT ss_file_copy | ( | const char * | src, |
const char * | dst, | ||
bool | append | ||
) |
Definition at line 6652 of file system.cxx.
INT ss_file_find | ( | const char * | path, |
const char * | pattern, | ||
STRING_LIST * | plist | ||
) |
Definition at line 6670 of file system.cxx.
Definition at line 6891 of file system.cxx.
double EXPRT ss_file_size | ( | const char * | path | ) |
time_t EXPRT ss_file_time | ( | const char * | path | ) |
Definition at line 1325 of file system.cxx.
Definition at line 1351 of file system.cxx.
Definition at line 7442 of file system.cxx.
std::string EXPRT ss_getcwd | ( | ) |
std::string ss_gethostname | ( | ) |
Definition at line 5645 of file system.cxx.
INT ss_gethostname | ( | char * | buffer, |
int | buffer_size | ||
) |
char EXPRT * ss_getpass | ( | const char * | prompt | ) |
Definition at line 7379 of file system.cxx.
char EXPRT * ss_gets | ( | char * | string, |
int | size | ||
) |
midas_thread_t EXPRT ss_gettid | ( | void | ) |
Definition at line 1490 of file system.cxx.
bool ss_is_valid_utf8 | ( | const char * | string | ) |
Definition at line 8007 of file system.cxx.
int EXPRT ss_isfin | ( | double | x | ) |
int EXPRT ss_isnan | ( | double | x | ) |
void ss_kill | ( | int | pid | ) |
Definition at line 1477 of file system.cxx.
|
static |
Returns the actual time in milliseconds with an arbitrary origin. This time may only be used to calculate relative times.
Overruns in the 32 bit value don't hurt since in a subtraction calculated with 32 bit accuracy this overrun cancels (you may think about!)..
Definition at line 3332 of file system.cxx.
Definition at line 2880 of file system.cxx.
Definition at line 3150 of file system.cxx.
Definition at line 3096 of file system.cxx.
Definition at line 2976 of file system.cxx.
double EXPRT ss_nan | ( | ) |
BOOL ss_pid_exists | ( | int | pid | ) |
Definition at line 1446 of file system.cxx.
INT EXPRT ss_recv_net_command | ( | int | sock, |
DWORD * | routine_id, | ||
DWORD * | param_size, | ||
char ** | param_ptr, | ||
int | timeout_ms | ||
) |
Definition at line 5568 of file system.cxx.
bool ss_repair_utf8 | ( | char * | string | ) |
Definition at line 8090 of file system.cxx.
bool ss_repair_utf8 | ( | std::string & | s | ) |
Definition at line 8186 of file system.cxx.
std::string EXPRT ss_replace_env_variables | ( | const std::string & | inputPath | ) |
Definition at line 2183 of file system.cxx.
Definition at line 4783 of file system.cxx.
Definition at line 2427 of file system.cxx.
Definition at line 2808 of file system.cxx.
Definition at line 2720 of file system.cxx.
Definition at line 2600 of file system.cxx.
void ss_set_screen_size | ( | int | x, |
int | y | ||
) |
Definition at line 7288 of file system.cxx.
Definition at line 3414 of file system.cxx.
INT ss_shell | ( | int | sock | ) |
Definition at line 1731 of file system.cxx.
Definition at line 764 of file system.cxx.
Definition at line 917 of file system.cxx.
INT ss_shm_flush | ( | const char * | name, |
const void * | adr, | ||
size_t | size, | ||
HNDLE | handle, | ||
bool | wait_for_thread | ||
) |
Definition at line 1182 of file system.cxx.
INT ss_shm_flush_thread | ( | void * | p | ) |
Definition at line 1142 of file system.cxx.
|
static |
Definition at line 239 of file system.cxx.
INT ss_shm_open | ( | const char * | name, |
INT | size, | ||
void ** | adr, | ||
size_t * | shm_size, | ||
HNDLE * | handle, | ||
BOOL | get_size | ||
) |
Definition at line 333 of file system.cxx.
Definition at line 1009 of file system.cxx.
INT ss_shm_unprotect | ( | HNDLE | handle, |
void ** | adr, | ||
size_t | shm_size, | ||
BOOL | read, | ||
BOOL | write, | ||
const char * | caller_name | ||
) |
Definition at line 1066 of file system.cxx.
Suspend the calling process for a certain time.
The function is similar to the sleep() function, but has a resolution of one milliseconds. Under VxWorks the resolution is 1/60 of a second. It uses the socket select() function with a time-out. See examples in ss_time()
millisec | Time in milliseconds to sleep. Zero means infinite (until another process calls ss_wake) |
Definition at line 3567 of file system.cxx.
|
static |
Definition at line 4432 of file system.cxx.
Definition at line 5164 of file system.cxx.
INT EXPRT ss_socket_connect_tcp | ( | const char * | hostname, |
int | tcp_port, | ||
int * | sockp, | ||
std::string * | error_msg_p | ||
) |
Definition at line 4906 of file system.cxx.
Definition at line 5179 of file system.cxx.
INT EXPRT ss_socket_listen_tcp | ( | bool | listen_localhost, |
int | tcp_port, | ||
int * | sockp, | ||
int * | tcp_port_p, | ||
std::string * | error_msg_p | ||
) |
Definition at line 5001 of file system.cxx.
Definition at line 4837 of file system.cxx.
Definition at line 1601 of file system.cxx.
void EXPRT ss_stack_history_dump | ( | char * | filename | ) |
Definition at line 7983 of file system.cxx.
void EXPRT ss_stack_history_entry | ( | char * | tag | ) |
Definition at line 7961 of file system.cxx.
void EXPRT ss_stack_print | ( | ) |
Definition at line 4482 of file system.cxx.
|
static |
Definition at line 4146 of file system.cxx.
INT ss_suspend_exit | ( | ) |
Definition at line 4165 of file system.cxx.
INT ss_suspend_get_buffer_port | ( | midas_thread_t | thread_id, |
INT * | port | ||
) |
Definition at line 4292 of file system.cxx.
SUSPEND_STRUCT* ss_suspend_get_struct | ( | midas_thread_t | thread_id | ) |
Definition at line 4104 of file system.cxx.
INT ss_suspend_init_odb_port | ( | ) |
Definition at line 4244 of file system.cxx.
|
static |
Definition at line 3951 of file system.cxx.
Definition at line 4325 of file system.cxx.
INT ss_suspend_set_client_connection | ( | RPC_SERVER_CONNECTION * | connection | ) |
INT ss_suspend_set_client_listener | ( | int | listen_socket | ) |
INT ss_suspend_set_rpc_thread | ( | midas_thread_t | thread_id | ) |
Definition at line 3941 of file system.cxx.
INT ss_suspend_set_server_acceptions | ( | RPC_SERVER_ACCEPTION_LIST * | acceptions | ) |
INT ss_suspend_set_server_listener | ( | int | listen_socket | ) |
Execute command in a separate process, close all open file descriptors invoke ss_exec() and ignore pid.
command | Command to execute. |
Definition at line 2087 of file system.cxx.
Definition at line 5841 of file system.cxx.
Definition at line 6171 of file system.cxx.
Definition at line 6507 of file system.cxx.
Definition at line 6395 of file system.cxx.
Definition at line 5750 of file system.cxx.
Definition at line 6031 of file system.cxx.
Definition at line 6287 of file system.cxx.
Definition at line 6339 of file system.cxx.
Definition at line 5885 of file system.cxx.
Definition at line 6451 of file system.cxx.
Definition at line 5971 of file system.cxx.
Definition at line 6105 of file system.cxx.
midas_thread_t EXPRT ss_thread_create | ( | INT(*)(void *) | thread_func, |
void * | param | ||
) |
Creates and returns a new thread of execution.
Note the difference when calling from vxWorks versus Linux and Windows. The parameter pointer for a vxWorks call is a VX_TASK_SPAWN structure, whereas for Linux and Windows it is a void pointer. Early versions returned SS_SUCCESS or SS_NO_THREAD instead of thread ID.
Example for VxWorks
Example for Linux
(*thread_func) | Thread function to create. |
param | a pointer to a VX_TASK_SPAWN structure for vxWorks and a void pointer for Unix and Windows |
Definition at line 2277 of file system.cxx.
std::string ss_thread_get_name | ( | ) |
INT EXPRT ss_thread_kill | ( | midas_thread_t | thread_id | ) |
Destroys the thread identified by the passed thread id. The thread id is returned by ss_thread_create() on creation.
thread_id | the thread id of the thread to be killed. |
Definition at line 2350 of file system.cxx.
Definition at line 2393 of file system.cxx.
std::string ss_tid_to_string | ( | midas_thread_t | thread_id | ) |
Returns the actual time in seconds since 1.1.1970 UTC.
Definition at line 3401 of file system.cxx.
double EXPRT ss_time_sec | ( | ) |
Definition at line 3406 of file system.cxx.
bool EXPRT ss_timed_mutex_wait_for_sec | ( | std::timed_mutex & | mutex, |
const char * | mutex_name, | ||
double | timeout_sec | ||
) |
Definition at line 3204 of file system.cxx.
void EXPRT ss_tzset | ( | ) |
unsigned int ss_us_since | ( | std::chrono::time_point< std::chrono::high_resolution_clock > | start | ) |
Definition at line 8199 of file system.cxx.
std::chrono::time_point<std::chrono::high_resolution_clock> ss_us_start | ( | ) |
Definition at line 8194 of file system.cxx.
Definition at line 5285 of file system.cxx.
|
static |
Definition at line 1970 of file system.cxx.
|
static |
Definition at line 3926 of file system.cxx.
|
static |
Definition at line 3923 of file system.cxx.
|
static |
Definition at line 3925 of file system.cxx.
|
static |
Definition at line 3921 of file system.cxx.
|
static |
Definition at line 3918 of file system.cxx.
|
static |
Definition at line 3929 of file system.cxx.
|
static |
Definition at line 3922 of file system.cxx.
|
static |
Definition at line 3928 of file system.cxx.
|
static |
Definition at line 3919 of file system.cxx.
|
static |
Definition at line 3916 of file system.cxx.
char { ... } c |
Definition at line 1316 of file system.cxx.
char { ... } c |
Definition at line 1322 of file system.cxx.
double { ... } d |
Definition at line 1317 of file system.cxx.
double { ... } d |
Definition at line 1321 of file system.cxx.
|
static |
Definition at line 4903 of file system.cxx.
|
static |
Definition at line 3292 of file system.cxx.
void(* MidasExceptionHandler) (void) | ( | void | ) |
Definition at line 3728 of file system.cxx.
|
static |
Definition at line 2425 of file system.cxx.
|
static |
Definition at line 2424 of file system.cxx.
char stack_history[N_STACK_HISTORY][80] |
Definition at line 7930 of file system.cxx.
int stack_history_pointer = -1 |
Definition at line 7931 of file system.cxx.
struct { ... } test_align |
struct { ... } test_padding |