Update MINIX-specific messages and comments

This commit is contained in:
Eirikr Hinngart 2025-05-29 18:48:21 -07:00
parent 412e9894b1
commit a4d9be31c5
6 changed files with 30 additions and 28 deletions

View File

@ -168,10 +168,9 @@
#define MKF_I386_AMD_SYSCALL (1L << 1) /* SYSCALL available and supported */ #define MKF_I386_AMD_SYSCALL (1L << 1) /* SYSCALL available and supported */
/* /*
* Number of per-CPU states for which time will be accounted. This *must* be * Number of per-CPU states for which time will be accounted. This value must
* the same value as NetBSD's CPUSTATES, which is defined in a rather * remain in sync with CPUSTATES defined in sys/sched.h. When CPUSTATES
* unfortunate location (sys/sched.h). If the NetBSD value changes, our kernel * changes, the MINIX kernel code must be updated accordingly.
* must be adapted accordingly.
*/ */
#define MINIX_CPUSTATES 5 #define MINIX_CPUSTATES 5

View File

@ -12,7 +12,7 @@
#include <sys/sched.h> /* for CP_*, CPUSTATES */ #include <sys/sched.h> /* for CP_*, CPUSTATES */
#if CPUSTATES != MINIX_CPUSTATES #if CPUSTATES != MINIX_CPUSTATES
/* If this breaks, the code in this file may have to be adapted accordingly. */ /* If this breaks, the code in this file may have to be adapted accordingly. */
#error "MINIX_CPUSTATES value is out of sync with NetBSD's!" #error "MINIX_CPUSTATES value is out of sync with CPUSTATES!"
#endif #endif
#include "kernel/spinlock.h" #include "kernel/spinlock.h"

View File

@ -9,7 +9,7 @@
#include <sys/sched.h> /* for CP_*, CPUSTATES */ #include <sys/sched.h> /* for CP_*, CPUSTATES */
#if CPUSTATES != MINIX_CPUSTATES #if CPUSTATES != MINIX_CPUSTATES
/* If this breaks, the code in this file may have to be adapted accordingly. */ /* If this breaks, the code in this file may have to be adapted accordingly. */
#error "MINIX_CPUSTATES value is out of sync with NetBSD's!" #error "MINIX_CPUSTATES value is out of sync with CPUSTATES!"
#endif #endif
#ifdef USE_APIC #ifdef USE_APIC

View File

@ -263,14 +263,15 @@ cpuavg_getstats(const struct cpuavg * ca_orig, uint32_t * cpticks,
*cpticks = ca.ca_run >> FSHIFT; *cpticks = ca.ca_run >> FSHIFT;
/* /*
* NetBSD's estcpu value determines a scheduling queue, and decays to * In traditional BSD kernels, the 'estcpu' value determines a
* 10% in 5*(the current load average) seconds. Our 'estcpu' simply * scheduling queue and decays to 10% in 5*(the current load average)
* reports the process's percentage of CPU usage in the last second, * seconds. MINIX reports the process's percentage of CPU usage in the
* thus yielding a value in the range 0..100 with a decay of 100% after * last second instead, yielding a value in the range 0..100 with a
* one second. This should be good enough for most practical purposes. * decay of 100% after one second. This should be good enough for most
*/ * practical purposes.
*estcpu = (ca.ca_last / hz * 100) >> FSHIFT; */
*estcpu = (ca.ca_last / hz * 100) >> FSHIFT;
return ca.ca_avg; return ca.ca_avg;
} }

View File

@ -520,12 +520,13 @@ uds_send_peer(struct udssock * uds, const struct sockaddr * addr,
} else } else
peer = uds->uds_link; peer = uds->uds_link;
/* /*
* If the receiving end will never receive this packet, we * If the receiving end will never receive this packet, we
* might as well not send it, so drop it immeiately. Indicate * might as well not send it, so drop it immediately. Indicate
* as such to the caller, using NetBSD's chosen error code. * this condition to the caller using the MINIX error code for a
*/ * full buffer.
if (uds_is_shutdown(peer, SFL_SHUT_RD)) */
if (uds_is_shutdown(peer, SFL_SHUT_RD))
return ENOBUFS; return ENOBUFS;
} else { } else {
assert(uds_has_conn(uds)); assert(uds_has_conn(uds));
@ -669,9 +670,10 @@ uds_send_data(struct udssock * uds, struct udssock * peer,
if (seglen > avail) { if (seglen > avail) {
assert(uds_get_type(uds) == SOCK_DGRAM); assert(uds_get_type(uds) == SOCK_DGRAM);
/* Drop the packet, borrowing NetBSD's chosen error code. */ /* Drop the packet and return the MINIX error code for
return ENOBUFS; * insufficient buffer space. */
} return ENOBUFS;
}
/* /*
* Generate the full segment, but do not yet update the buffer head. * Generate the full segment, but do not yet update the buffer head.

View File

@ -344,11 +344,11 @@ int rw_pipe(int rw_flag, endpoint_t usr_e, struct filp *f, int callnr, int fd,
if (r == SUSPEND) if (r == SUSPEND)
pipe_suspend(callnr, fd, buf, nbytes, cum_io); pipe_suspend(callnr, fd, buf, nbytes, cum_io);
/* If pipe_check returns an error instead of suspending the call, we /* If pipe_check returns an error instead of suspending the call, we
* return that error, even if we are resuming a partially completed * return that error, even if we are resuming a partially completed
* operation (ie, a large blocking write), to match NetBSD's behavior. * operation (ie, a large blocking write), to follow MINIX semantics.
*/ */
return(r); return(r);
} }
size = r; size = r;