Skip to content

Commit 71a772b

Browse files
author
di
committed
2 parents a0e6f4e + 34b6076 commit 71a772b

23 files changed

Lines changed: 38 additions & 39 deletions

File tree

kernel/bin/ping.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ static int ping_v4(file *fd, const ping_opts_t *o) {
189189
write_file(fd, "\n", 1);
190190
}
191191

192-
if (i + 1 < o->count) sleep(o->interval_ms);
192+
if (i + 1 < o->count) msleep(o->interval_ms);
193193
}
194194

195195
write_file(fd, "\n", 1);

kernel/bin/tracert.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ static int tracert_v4(file *fd, const tr_opts_t *o) {
177177
}
178178
}
179179

180-
if (p + 1 < o->count) sleep(o->interval_ms);
180+
if (p + 1 < o->count) msleep(o->interval_ms);
181181
}
182182

183183
if (any) {

kernel/kernel_processes/boot/bootscreen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ int bootscreen(){
139139
boot_draw_lines(current_point, next_point, screen_size, boot_theme.logo_repeat, 5);
140140
current_point = next_point;
141141
}
142-
sleep(1000);
142+
msleep(1000);
143143
}
144144
return 0;
145145
}

kernel/kernel_processes/monitor/monitor_processes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void print_process_info(){
4646
printf("PC: %x",proc->pc);
4747
}
4848
}
49-
sleep(1000);
49+
msleep(1000);
5050
}
5151

5252
#define PROCS_PER_SCREEN 2

kernel/memory/mmu.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "process/scheduler.h"
1313
#include "sysregs.h"
1414
#include "std/memory.h"
15-
#include <stdint.h>
1615

1716
#define PD_TABLE 0b11
1817
#define PD_BLOCK 0b01

kernel/networking/application_layer/dhcp_daemon.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static bool udp_wait_for_type_on(socket_handle_t sock, uint8_t wanted, uint32_t
173173
if (outsp) *outsp = (sizedptr){ copy, (uint32_t)r };
174174
return true;
175175
} else {
176-
sleep(50);
176+
msleep(50);
177177
waited += 50;
178178
}
179179
}
@@ -206,7 +206,7 @@ static bool udp_wait_for_ack_or_nak(socket_handle_t sock, uint32_t expect_xid, c
206206
if (out_msg_type) *out_msg_type = mtype;
207207
return true;
208208
} else {
209-
sleep(50);
209+
msleep(50);
210210
waited += 50;
211211
}
212212
}
@@ -584,14 +584,14 @@ int dhcp_daemon_entry(int argc, char* argv[]) {
584584
dhcp_set_pid(g_pid_dhcpd);
585585
for (;;) {
586586
ensure_inventory();
587-
if (g_if_count == 0) { sleep(250); continue; }
587+
if (g_if_count == 0) { msleep(250); continue; }
588588
for (int i = 0; i < g_if_count; i++) {
589589
l3_ipv4_interface_t* v4 = l3_ipv4_find_by_id(g_if[i].l3_id);
590590
if (!v4) continue;
591591
if (v4->mode == IPV4_CFG_DHCP) fsm_once_for(&g_if[i]);
592592
}
593593
maybe_send_inform();
594-
sleep(100);
594+
msleep(100);
595595
tick_timers();
596596
}
597597
}

kernel/networking/application_layer/dns.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static dns_result_t perform_dns_query_once_a(socket_handle_t sock, uint32_t dns_
129129
if (pr == DNS_OK){ *out_ip = ip_host; return DNS_OK; }
130130
if (pr == DNS_ERR_NXDOMAIN) return pr;
131131
} else {
132-
sleep(50);
132+
msleep(50);
133133
waited_ms += 50;
134134
}
135135
}
@@ -167,7 +167,7 @@ static dns_result_t perform_dns_query_once_aaaa(socket_handle_t sock, uint32_t d
167167
if (pr == DNS_OK) return DNS_OK;
168168
if (pr == DNS_ERR_NXDOMAIN) return pr;
169169
} else {
170-
sleep(50);
170+
msleep(50);
171171
waited_ms += 50;
172172
}
173173
}

kernel/networking/application_layer/dns_daemon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ int dns_deamon_entry(int argc, char* argv[]){
1515
(void)argc; (void)argv;
1616
dns_set_pid(get_current_proc_pid());
1717
g_sock = udp_socket_create(SOCK_ROLE_CLIENT, g_pid_dnsd);
18-
for(;;){ sleep(250); }
18+
for(;;){ msleep(250); }
1919
return 1;
2020
}

kernel/networking/application_layer/sntp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ sntp_result_t sntp_poll_once(uint32_t timeout_ms){
155155
}
156156
}
157157
} else {
158-
sleep(50);
158+
msleep(50);
159159
waited += 50;
160160
}
161161

kernel/networking/application_layer/sntp_daemon.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ int sntp_daemon_entry(int argc, char* argv[]){
4747
uint32_t attempts = 0;
4848
while (attempts < SNTP_BOOTSTRAP_MAX_RETRY){
4949
if (!any_ipv4_configured_nonlocal()){
50-
sleep(500);
50+
msleep(500);
5151
continue;
5252
}
5353
sntp_result_t r = sntp_poll_once(SNTP_QUERY_TIMEOUT_MS);
@@ -57,11 +57,11 @@ int sntp_daemon_entry(int argc, char* argv[]){
5757
attempts++;
5858
uint32_t backoff_ms = (1u << (attempts <= 4 ? attempts : 4)) * 250u;
5959
uint32_t jitter = backoff_ms / 10u;
60-
sleep(backoff_ms + (jitter / 2u));
60+
msleep(backoff_ms + (jitter / 2u));
6161
}
6262
for(;;){
6363
sntp_poll_once(SNTP_QUERY_TIMEOUT_MS);
64-
sleep(SNTP_POLL_INTERVAL_MS);
64+
msleep(SNTP_POLL_INTERVAL_MS);
6565
}
6666
return 1;
6767
}

0 commit comments

Comments
 (0)