-
-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
abis/linux: Add 64 bit counterparts of structs
options/posix: Add 64 bit counterparts of structs and functions
- Loading branch information
1 parent
d2e207f
commit d7f69aa
Showing
27 changed files
with
155 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,47 @@ | ||
#include <bits/sigset_t.h> | ||
#include <bits/ensure.h> | ||
#include <errno.h> | ||
#include <limits.h> | ||
#include <string.h> | ||
|
||
int sigemptyset(sigset_t *sigset) { | ||
*sigset = 0; | ||
memset(sigset, 0, sizeof(*sigset)); | ||
return 0; | ||
} | ||
|
||
int sigfillset(sigset_t *sigset) { | ||
*sigset = ~sigset_t(0); | ||
memset(sigset, ~0, sizeof(*sigset)); | ||
return 0; | ||
} | ||
|
||
// TODO: Return EINVAL instead of __ensure()ing. | ||
|
||
int sigaddset(sigset_t *sigset, int sig) { | ||
int signo = sig - 1; | ||
// TODO: do not hard code CHAR_BITS | ||
__ensure((unsigned int)signo < sizeof(sigset_t) * 8); | ||
*sigset |= sigset_t(1) << signo; | ||
if(signo < 0 || static_cast<unsigned int>(signo) >= (sizeof(sigset_t) * CHAR_BIT)) { | ||
errno = EINVAL; | ||
return -1; | ||
} | ||
auto ptr = reinterpret_cast<char *>(sigset); | ||
ptr[signo / CHAR_BIT] |= (1 << (signo % CHAR_BIT)); | ||
return 0; | ||
} | ||
|
||
int sigdelset(sigset_t *sigset, int sig) { | ||
int signo = sig - 1; | ||
// TODO: do not hard code CHAR_BITS | ||
__ensure((unsigned int)signo < sizeof(sigset_t) * 8); | ||
*sigset &= ~(sigset_t(1) << signo); | ||
if(signo < 0 || static_cast<unsigned int>(signo) >= (sizeof(sigset_t) * CHAR_BIT)) { | ||
errno = EINVAL; | ||
return -1; | ||
} | ||
auto ptr = reinterpret_cast<char *>(sigset); | ||
ptr[signo / CHAR_BIT] &= ~(1 << (signo % CHAR_BIT)); | ||
return 0; | ||
} | ||
|
||
int sigismember(const sigset_t *set, int sig) { | ||
int sigismember(const sigset_t *sigset, int sig) { | ||
int signo = sig - 1; | ||
// TODO: do not hard code CHAR_BITS | ||
__ensure((unsigned int)signo < sizeof(sigset_t) * 8); | ||
return (*set) & (sigset_t(1) << signo); | ||
if(signo < 0 || static_cast<unsigned int>(signo) >= (sizeof(sigset_t) * CHAR_BIT)) { | ||
errno = EINVAL; | ||
return -1; | ||
} | ||
auto ptr = reinterpret_cast<const char *>(sigset); | ||
return !!(ptr[signo / CHAR_BIT] & (1 << (signo % CHAR_BIT))); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.