Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F143338890
D54751.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D54751.diff
View Options
diff --git a/lib/libc/gen/exterr_cat_filenames.h b/lib/libc/gen/exterr_cat_filenames.h
--- a/lib/libc/gen/exterr_cat_filenames.h
+++ b/lib/libc/gen/exterr_cat_filenames.h
@@ -2,16 +2,17 @@
* Automatically @generated, use
* tools/build/make_libc_exterr_cat_filenames.sh
*/
+ [EXTERR_CAT_BRIDGE] = "net/if_bridge.c",
[EXTERR_CAT_FUSE_DEVICE] = "fs/fuse/fuse_device.c",
- [EXTERR_CAT_FUSE_VFS] = "fs/fuse/fuse_vfsops.c",
[EXTERR_CAT_FUSE_VNOPS] = "fs/fuse/fuse_vnops.c",
- [EXTERR_CAT_GEOM] = "geom/geom_subr.c",
- [EXTERR_CAT_GEOMVFS] = "geom/geom_vfs.c",
- [EXTERR_CAT_FILEDESC] = "kern/kern_descrip.c",
+ [EXTERR_CAT_FUSE_VFS] = "fs/fuse/fuse_vfsops.c",
[EXTERR_CAT_INOTIFY] = "kern/vfs_inotify.c",
[EXTERR_CAT_GENIO] = "kern/sys_generic.c",
[EXTERR_CAT_VFSBIO] = "kern/vfs_bio.c",
[EXTERR_CAT_VFSSYSCALL] = "kern/vfs_syscalls.c",
- [EXTERR_CAT_BRIDGE] = "net/if_bridge.c",
+ [EXTERR_CAT_TIME] = "kern/kern_time.c",
+ [EXTERR_CAT_FILEDESC] = "kern/kern_descrip.c",
[EXTERR_CAT_SWAP] = "vm/swap_pager.c",
[EXTERR_CAT_MMAP] = "vm/vm_mmap.c",
+ [EXTERR_CAT_GEOM] = "geom/geom_subr.c",
+ [EXTERR_CAT_GEOMVFS] = "geom/geom_vfs.c",
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -32,10 +32,12 @@
#include <sys/cdefs.h>
#include "opt_ktrace.h"
+#define EXTERR_CATEGORY EXTERR_CAT_TIME
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/limits.h>
#include <sys/clock.h>
+#include <sys/exterrvar.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/sysproto.h>
@@ -216,7 +218,7 @@
*clk_id = MAKE_THREAD_CPUCLOCK(tid);
return (0);
default:
- return (EINVAL);
+ return (EXTERROR(EINVAL, "Invalid which"));
}
}
@@ -300,14 +302,14 @@
tid = clock_id & CPUCLOCK_ID_MASK;
td2 = tdfind(tid, p->p_pid);
if (td2 == NULL)
- return (EINVAL);
+ return (EXTERROR(EINVAL, "Invalid thread id"));
kern_thread_cputime(td2, ats);
PROC_UNLOCK(td2->td_proc);
} else {
pid = clock_id & CPUCLOCK_ID_MASK;
error = pget(pid, PGET_CANSEE, &p2);
if (error != 0)
- return (EINVAL);
+ return (EXTERROR(EINVAL, "Invalid process id"));
kern_process_cputime(p2, ats);
PROC_UNLOCK(p2);
}
@@ -381,7 +383,7 @@
break;
default:
if ((int)clock_id >= 0)
- return (EINVAL);
+ return (EXTERROR(EINVAL, "unknown clockid"));
return (get_cputime(td, clock_id, ats));
}
return (0);
@@ -419,13 +421,13 @@
if ((error = priv_check(td, PRIV_CLOCK_SETTIME)) != 0)
return (error);
if (clock_id != CLOCK_REALTIME)
- return (EINVAL);
+ return (EXTERROR(EINVAL, "clock_id not CLOCK_REALTIME"));
if (!timespecvalid_interval(ats))
- return (EINVAL);
+ return (EXTERROR(EINVAL, "Invalid timespec"));
if (!allow_insane_settime &&
(ats->tv_sec > 8000ULL * 365 * 24 * 60 * 60 ||
ats->tv_sec < utc_offset()))
- return (EINVAL);
+ return (EXTERROR(EINVAL, "Insade clock jump"));
/* XXX Don't convert nsec->usec and back */
TIMESPEC_TO_TIMEVAL(&atv, ats);
error = settime(td, &atv);
@@ -493,7 +495,7 @@
default:
if ((int)clock_id < 0)
goto cputime;
- return (EINVAL);
+ return (EXTERROR(EINVAL, "clock_id invalid"));
}
return (0);
}
@@ -523,9 +525,9 @@
bool is_abs_real, precise;
if (rqt->tv_nsec < 0 || rqt->tv_nsec >= NS_PER_SEC)
- return (EINVAL);
+ return (EXTERROR(EINVAL, "rqt bad nanosecond"));
if ((flags & ~TIMER_ABSTIME) != 0)
- return (EINVAL);
+ return (EXTERROR(EINVAL, "Bad timer flags set"));
switch (clock_id) {
case CLOCK_REALTIME:
case CLOCK_TAI:
@@ -562,7 +564,7 @@
return (ENOTSUP);
case CLOCK_THREAD_CPUTIME_ID:
default:
- return (EINVAL);
+ return (EXTERROR(EINVAL, "clock_id invalid"));
}
do {
ts = *rqt;
@@ -741,7 +743,7 @@
if (tv) {
if (tv->tv_usec < 0 || tv->tv_usec >= 1000000 ||
tv->tv_sec < 0)
- return (EINVAL);
+ return (EXTERROR(EINVAL, "Bad timeval"));
error = settime(td, tv);
}
return (error);
@@ -793,7 +795,7 @@
struct timeval ctv;
if (which > ITIMER_PROF)
- return (EINVAL);
+ return (EXTERROR(EINVAL, "Invalid itimer type"));
if (which == ITIMER_REAL) {
/*
@@ -861,19 +863,19 @@
return (kern_getitimer(td, which, oitv));
if (which > ITIMER_PROF)
- return (EINVAL);
+ return (EXTERROR(EINVAL, "Invalid itimer type"));
#ifdef KTRACE
if (KTRPOINT(td, KTR_STRUCT))
ktritimerval(aitv);
#endif
if (itimerfix(&aitv->it_value) ||
aitv->it_value.tv_sec > INT32_MAX / 2)
- return (EINVAL);
+ return (EXTERROR(EINVAL, "Interval too large"));
if (!timevalisset(&aitv->it_value))
timevalclear(&aitv->it_interval);
else if (itimerfix(&aitv->it_interval) ||
aitv->it_interval.tv_sec > INT32_MAX / 2)
- return (EINVAL);
+ return (EXTERROR(EINVAL, "Interval too large for existing timer"));
if (which == ITIMER_REAL) {
PROC_LOCK(p);
@@ -1280,20 +1282,20 @@
int error;
if (clock_id < 0 || clock_id >= MAX_CLOCKS)
- return (EINVAL);
+ return (EXTERROR(EINVAL, "Invalid clock id"));
if (posix_clocks[clock_id].timer_create == NULL)
- return (EINVAL);
+ return (EXTERROR(EINVAL, "Null posix clock"));
if (evp != NULL) {
if (evp->sigev_notify != SIGEV_NONE &&
evp->sigev_notify != SIGEV_SIGNAL &&
evp->sigev_notify != SIGEV_THREAD_ID)
- return (EINVAL);
+ return (EXTERROR(EINVAL, "sigev_notify invalid"));
if ((evp->sigev_notify == SIGEV_SIGNAL ||
evp->sigev_notify == SIGEV_THREAD_ID) &&
!_SIG_VALID(evp->sigev_signo))
- return (EINVAL);
+ return (EXTERROR(EINVAL, "signal number invalid"));
}
if (p->p_itimers == NULL)
@@ -1418,7 +1420,7 @@
it = itimer_find(p, timerid);
if (it == NULL) {
PROC_UNLOCK(p);
- return (EINVAL);
+ return (EXTERROR(EINVAL, "No itimer found"));
}
PROC_UNLOCK(p);
@@ -1476,7 +1478,7 @@
PROC_LOCK(p);
if (timer_id < 3 || (it = itimer_find(p, timer_id)) == NULL) {
PROC_UNLOCK(p);
- error = EINVAL;
+ error = EXTERROR(EINVAL, "No itimer found");
} else {
PROC_UNLOCK(p);
itimer_enter(it);
@@ -1517,7 +1519,7 @@
PROC_LOCK(p);
if (timer_id < 3 || (it = itimer_find(p, timer_id)) == NULL) {
PROC_UNLOCK(p);
- error = EINVAL;
+ error = EXTERROR(EINVAL, "No itimer found");
} else {
PROC_UNLOCK(p);
itimer_enter(it);
@@ -1551,7 +1553,7 @@
if (timer_id < 3 ||
(it = itimer_find(p, timer_id)) == NULL) {
PROC_UNLOCK(p);
- error = EINVAL;
+ error = EXTERROR(EINVAL, "No itimer found");
} else {
td->td_retval[0] = it->it_overrun_last;
ITIMER_UNLOCK(it);
@@ -1623,11 +1625,11 @@
val = *value;
if (itimespecfix(&val.it_value))
- return (EINVAL);
+ return (EXTERROR(EINVAL, "Cannot fix itimer"));
if (timespecisset(&val.it_value)) {
if (itimespecfix(&val.it_interval))
- return (EINVAL);
+ return (EXTERROR(EINVAL, "Cannot fix interval"));
} else {
timespecclear(&val.it_interval);
}
diff --git a/sys/sys/exterr_cat.h b/sys/sys/exterr_cat.h
--- a/sys/sys/exterr_cat.h
+++ b/sys/sys/exterr_cat.h
@@ -37,6 +37,7 @@
#define EXTERR_CAT_GEOM 12
#define EXTERR_CAT_FUSE_VFS 13
#define EXTERR_CAT_FUSE_DEVICE 14
+#define EXTERR_CAT_TIME 15
#endif
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 30, 3:05 AM (3 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28093519
Default Alt Text
D54751.diff (6 KB)
Attached To
Mode
D54751: time: Add EXTERROR for all EINVAL returns
Attached
Detach File
Event Timeline
Log In to Comment