summaryrefslogtreecommitdiff
path: root/src/ipcpd/shim-udp/main.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2017-12-02 14:01:03 +0100
committerSander Vrijders <sander.vrijders@ugent.be>2017-12-02 14:56:20 +0100
commit9b8a3e11c558877c09416991ff1ec840fea6d0ab (patch)
treef2faf7a4ab45687782a010fb6e48829e8ee1bdeb /src/ipcpd/shim-udp/main.c
parentf43e5e2329fb798047d15dd0748e5eef3359c966 (diff)
downloadouroboros-9b8a3e11c558877c09416991ff1ec840fea6d0ab.tar.gz
ouroboros-9b8a3e11c558877c09416991ff1ec840fea6d0ab.zip
lib, tools: Rename application process and instance
This refactors ouroboros to use "program" instead of "application process" and "process" instead of "application process instance" to align with current naming in current Operating Systems courses instead of the ISO nomenclature adopted by RINA. This change permeates through the entire implementation. Also contains some minor other refactors. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src/ipcpd/shim-udp/main.c')
-rw-r--r--src/ipcpd/shim-udp/main.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c
index f8248f86..4fafc4de 100644
--- a/src/ipcpd/shim-udp/main.c
+++ b/src/ipcpd/shim-udp/main.c
@@ -631,7 +631,7 @@ static int ipcp_udp_bootstrap(const struct ipcp_config * conf)
goto fail_sduloop;
}
- log_dbg("Bootstrapped shim IPCP over UDP with api %d.", getpid());
+ log_dbg("Bootstrapped shim IPCP over UDP with pid %d.", getpid());
log_dbg("Bound to IP address %s.", ipstr);
log_dbg("DNS server address is %s.", dnsstr);
@@ -654,7 +654,7 @@ static int ipcp_udp_bootstrap(const struct ipcp_config * conf)
/* NOTE: Disgusted with this crap */
static int ddns_send(char * cmd)
{
- pid_t api = -1;
+ pid_t pid = -1;
int wstatus;
int pipe_fd[2];
char * argv[] = {NSUPDATE_EXEC, 0};
@@ -665,13 +665,13 @@ static int ddns_send(char * cmd)
return -1;
}
- api = fork();
- if (api == -1) {
+ pid = fork();
+ if (pid == -1) {
log_err("Failed to fork.");
return -1;
}
- if (api == 0) {
+ if (pid == 0) {
close(pipe_fd[1]);
dup2(pipe_fd[0], 0);
execve(argv[0], &argv[0], envp);
@@ -685,9 +685,8 @@ static int ddns_send(char * cmd)
return -1;
}
- waitpid(api, &wstatus, 0);
- if (WIFEXITED(wstatus) == true &&
- WEXITSTATUS(wstatus) == 0)
+ waitpid(pid, &wstatus, 0);
+ if (WIFEXITED(wstatus) && WEXITSTATUS(wstatus) == 0)
log_dbg("Succesfully communicated with DNS server.");
else
log_err("Failed to register with DNS server.");
@@ -699,7 +698,7 @@ static int ddns_send(char * cmd)
static uint32_t ddns_resolve(char * name,
uint32_t dns_addr)
{
- pid_t api = -1;
+ pid_t pid = -1;
int wstatus;
int pipe_fd[2];
char dnsstr[INET_ADDRSTRLEN];
@@ -718,13 +717,13 @@ static uint32_t ddns_resolve(char * name,
return 0;
}
- api = fork();
- if (api == -1) {
+ pid = fork();
+ if (pid == -1) {
log_err("Failed to fork.");
return 0;
}
- if (api == 0) {
+ if (pid == 0) {
char * argv[] = {NSLOOKUP_EXEC, name, dnsstr, 0};
char * envp[] = {0};
@@ -744,9 +743,8 @@ static uint32_t ddns_resolve(char * name,
close(pipe_fd[0]);
- waitpid(api, &wstatus, 0);
- if (WIFEXITED(wstatus) == true &&
- WEXITSTATUS(wstatus) == 0)
+ waitpid(pid, &wstatus, 0);
+ if (WIFEXITED(wstatus) && WEXITSTATUS(wstatus) == 0)
log_dbg("Succesfully communicated with nslookup.");
else
log_err("Failed to resolve DNS address.");