2005-09-15 09:58:31 -04:00
|
|
|
#ifndef EL__MAIN_MAIN_H
|
|
|
|
#define EL__MAIN_MAIN_H
|
|
|
|
|
2020-10-05 14:14:55 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2005-09-15 09:58:31 -04:00
|
|
|
enum retval {
|
|
|
|
RET_OK, /* All is well */
|
|
|
|
RET_ERROR, /* Failed to fetch URL or write document when dumping */
|
|
|
|
RET_SIGNAL, /* Catched SIGTERM which forced program to stop */
|
|
|
|
RET_SYNTAX, /* Cmdline syntax error or bad or missing dump URL */
|
|
|
|
RET_FATAL, /* Fatal error occurred during initialization */
|
|
|
|
RET_PING, /* --remote "ping()" found no running ELinkses */
|
|
|
|
RET_REMOTE, /* --remote failed to connect to a running ELinks */
|
|
|
|
RET_COMMAND, /* Used internally for exiting from cmdline commands */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct program {
|
|
|
|
int terminate;
|
|
|
|
enum retval retval;
|
2021-01-02 10:20:27 -05:00
|
|
|
char *path;
|
2005-09-15 09:58:31 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct program program;
|
[fg] track master proc for suspend via pids, not term fds, for fork_on_start
When ui.sessions.fork_on_start, we fork a process that has a different
fdout than get_output_handle() (which has hardcoded fdout of 1), so it
will never be considered term->master, yet this is the process we want
to wake up in SIGTSTP handler.
Since we cannot rely on term->master to determine if we are the master
process, we instead move master_pid to be set explicitly at the places
where we have information about whether our process is a master or a
slave: first on start, then once the interlink determination has been
made.
master_pid has to be set in both parent and child, because both will get
suspended and need to know which one needs to resume in background with
SIGCONT (the master). We can't inherit from the parent because it's
unknown at the time of fork.
Previously, master_pid worked correctly with fork_on_start=0,
-no-connect or -dump, but not with fork_on_start=1.
See #287 for background.
2024-04-10 17:02:36 -04:00
|
|
|
extern pid_t master_pid;
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
void shrink_memory(int);
|
2020-05-21 10:53:43 -04:00
|
|
|
void parse_options_again(void);
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2020-10-05 14:14:55 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-09-15 09:58:31 -04:00
|
|
|
#endif
|