Skip to content

Commit 19247d6

Browse files
Merge branch 'main.thttpd' of github.com:correctcomputation/checkedc
Try to sort out gettimeofday / settimeofday.
2 parents 10e1e02 + c14288d commit 19247d6

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

include/signal_checked.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ void (*signal(int sig,
2828
) : itype(_Ptr<void (int)>) // bounds-safe interface for signal return
2929
)(int);
3030

31+
_Unchecked
32+
void (*sigset(int sig,
33+
void ((*func)(int)) :
34+
itype(_Ptr<void (int)>) // bound-safe interface for func
35+
) : itype(_Ptr<void (int)>) // bounds-safe interface for signal return
36+
)(int);
3137

3238
int sigemptyset(sigset_t *set : itype(_Ptr<sigset_t>));
3339
int sigfillset(sigset_t *set : itype(_Ptr<sigset_t>));

include/sys/resource.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
//---------------------------------------------------------------------//
2+
// Wrapper header file that excludes Checked-C-specific declarations //
3+
// if the compilation is not for Checked C, or if is for Checked C //
4+
// but the implicit inclusion of checked header files is disabled. //
5+
/////////////////////////////////////////////////////////////////////////
6+
7+
18
#if !defined __checkedc || defined NO_IMPLICIT_INCLUDE_CHECKED_HDRS
29

310
#ifdef __checkedc

include/sys/resource_checked.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#pragma CHECKED_SCOPE push
2323
#pragma CHECKED_SCOPE on
2424

25+
int getrlimit(int resource, struct rlimit *rlim : itype(_Ptr<struct rlimit>));
2526
int setrlimit(int resource, const struct rlimit *rlim : itype(_Ptr<const struct rlimit>));
2627

2728
#pragma CHECKED_SCOPE pop

include/sys/time_checked.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
#pragma CHECKED_SCOPE push
2323
#pragma CHECKED_SCOPE on
2424

25+
// The man page shows the second parameter as `struct timezone *tz`, but glibc
26+
// has it as `void *`, and our redeclaration must be consistent with that.
27+
// ~ Matt 2021-12-07
2528
int gettimeofday(struct timeval * tv : itype(_Ptr<struct timeval>), void *tz : itype(_Array_ptr<void>) byte_count(sizeof(struct timezone)));
2629
int settimeofday(const struct timeval *tv : itype(_Ptr<const struct timeval>), const struct timezone *tz : itype(_Ptr<const struct timezone>));
2730

0 commit comments

Comments
 (0)