tests: use TAIL_ALLOC_OBJECT_CONST_PTR
Automatically convert tests to use TAIL_ALLOC_OBJECT_CONST_PTR macro with the following sed expression: sed -ri \ 's/^([[:space:]]*)(([^*]+[[:alnum:]_])( \*)?) *\*( *const )?([^ =]+) = tail_alloc\(sizeof\((\2|\*\6)\)\);/\1TAIL_ALLOC_OBJECT_CONST_PTR(\2, \6);/' \ tests/*.c
This commit is contained in:
parent
c36875b170
commit
eabace12c4
@ -43,7 +43,7 @@ main(void)
|
||||
int state = adjtimex(NULL);
|
||||
printf("adjtimex(NULL) = %s\n", sprintrc(state));
|
||||
|
||||
struct timex *const tx = tail_alloc(sizeof(*tx));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct timex, tx);
|
||||
memset(tx, 0, sizeof(*tx));
|
||||
|
||||
state = adjtimex(tx);
|
||||
|
@ -198,7 +198,7 @@ main(void)
|
||||
};
|
||||
const long *cbvs2 = tail_memdup(proto_cbvs2, sizeof(proto_cbvs2));
|
||||
|
||||
unsigned long *ctx = tail_alloc(sizeof(unsigned long));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(unsigned long, ctx);
|
||||
*ctx = 0;
|
||||
|
||||
const unsigned int nr = ARRAY_SIZE(proto_cb);
|
||||
|
@ -41,8 +41,8 @@ main(void)
|
||||
{
|
||||
const long int fd_in = (long int) 0xdeadbeefffffffff;
|
||||
const long int fd_out = (long int) 0xdeadbeeffffffffe;
|
||||
long long int *const off_in = tail_alloc(sizeof(*off_in));
|
||||
long long int *const off_out = tail_alloc(sizeof(*off_out));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(long long int, off_in);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(long long int, off_out);
|
||||
*off_in = 0xdeadbef1facefed1;
|
||||
*off_out = 0xdeadbef2facefed2;
|
||||
const size_t len = (size_t) 0xdeadbef3facefed3ULL;
|
||||
|
@ -18,7 +18,7 @@ invoke_syscall(unsigned long epfd, unsigned long op, unsigned long fd, void *ev)
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
struct epoll_event *const ev = tail_alloc(sizeof(*ev));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct epoll_event, ev);
|
||||
ev->events = EPOLLIN;
|
||||
|
||||
long rc = invoke_syscall(-1U, EPOLL_CTL_ADD, -2U, ev);
|
||||
|
@ -12,7 +12,7 @@ int
|
||||
main(void)
|
||||
{
|
||||
sigset_t set[2];
|
||||
struct epoll_event *const ev = tail_alloc(sizeof(*ev));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct epoll_event, ev);
|
||||
|
||||
long rc = syscall(__NR_epoll_pwait, -1, ev, 1, -2,
|
||||
set, (kernel_ulong_t) sizeof(set));
|
||||
|
@ -10,7 +10,7 @@
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
struct epoll_event *const ev = tail_alloc(sizeof(*ev));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct epoll_event, ev);
|
||||
|
||||
long rc = syscall(__NR_epoll_wait, -1, ev, 1, -2);
|
||||
printf("epoll_wait(-1, %p, 1, -2) = %ld %s (%m)\n",
|
||||
|
@ -103,7 +103,7 @@ main(void)
|
||||
#endif
|
||||
);
|
||||
|
||||
char **const empty = tail_alloc(sizeof(*empty));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(char *, empty);
|
||||
char **const efault = empty + 1;
|
||||
*empty = NULL;
|
||||
|
||||
|
@ -108,7 +108,7 @@ main(void)
|
||||
#endif
|
||||
errno2name());
|
||||
|
||||
char **const empty = tail_alloc(sizeof(*empty));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(char *, empty);
|
||||
char **const efault = empty + 1;
|
||||
*empty = NULL;
|
||||
|
||||
|
@ -208,7 +208,7 @@ main(void)
|
||||
tail_alloc(sizeof(struct file_handle) + 128);
|
||||
struct file_handle *handle_256 =
|
||||
tail_alloc(sizeof(struct file_handle) + 256);
|
||||
int *bogus_mount_id = tail_alloc(sizeof(*bogus_mount_id));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(int, bogus_mount_id);
|
||||
|
||||
char handle_0_addr[sizeof("0x") + sizeof(void *) * 2];
|
||||
|
||||
|
@ -13,7 +13,7 @@ static void
|
||||
test_fiemap(void)
|
||||
{
|
||||
(void) tail_alloc(1);
|
||||
struct fiemap *const args = tail_alloc(sizeof(*args));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct fiemap, args);
|
||||
|
||||
printf("ioctl(-1, FS_IOC_FIEMAP, {fm_start=%" PRI__u64
|
||||
", fm_length=%" PRI__u64", fm_flags=",
|
||||
|
@ -163,8 +163,8 @@ void invalid_op(int *val, int op, uint32_t argmask, ...)
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int *uaddr = tail_alloc(sizeof(*uaddr));
|
||||
int *uaddr2 = tail_alloc(sizeof(*uaddr2));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(int, uaddr);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(int, uaddr2);
|
||||
int rc;
|
||||
unsigned i;
|
||||
unsigned j;
|
||||
|
@ -47,8 +47,8 @@ main(void)
|
||||
(unsigned *) tail_alloc(sizeof(* bogus_tcache)) + 1;
|
||||
|
||||
long res;
|
||||
unsigned *cpu = tail_alloc(sizeof(*cpu));
|
||||
unsigned *node = tail_alloc(sizeof(*node));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(unsigned, cpu);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(unsigned, node);
|
||||
long * tcache = tail_alloc(128);
|
||||
|
||||
res = syscall(__NR_getcpu, NULL, NULL, NULL);
|
||||
|
@ -34,9 +34,9 @@
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
unsigned UGID_TYPE *const r = tail_alloc(sizeof(*r));
|
||||
unsigned UGID_TYPE *const e = tail_alloc(sizeof(*e));
|
||||
unsigned UGID_TYPE *const s = tail_alloc(sizeof(*s));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(unsigned UGID_TYPE, r);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(unsigned UGID_TYPE, e);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(unsigned UGID_TYPE, s);
|
||||
|
||||
if (syscall(SYSCALL_NR, r, e, s))
|
||||
perror_msg_and_fail(SYSCALL_NAME);
|
||||
|
@ -68,7 +68,7 @@ invoke_print(int who, const char *who_str, struct rusage *usage)
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
struct rusage *const usage = tail_alloc(sizeof(*usage));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct rusage, usage);
|
||||
if (invoke_print(ARG_STR(RUSAGE_SELF), usage)) {
|
||||
perror_msg_and_fail("RUSAGE_SELF");
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ main(void)
|
||||
ioctl(-1, BLKFRASET, lmagic);
|
||||
printf("ioctl(-1, BLKFRASET, %lu) = -1 EBADF (%m)\n", lmagic);
|
||||
|
||||
int *const val_int = tail_alloc(sizeof(*val_int));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(int, val_int);
|
||||
*val_int = magic;
|
||||
|
||||
ioctl(-1, BLKROSET, val_int);
|
||||
@ -144,7 +144,7 @@ main(void)
|
||||
" = -1 EBADF (%m)\n", pair_int64[0], pair_int64[1]);
|
||||
#endif
|
||||
|
||||
struct blkpg_ioctl_arg *const blkpg = tail_alloc(sizeof(*blkpg));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct blkpg_ioctl_arg, blkpg);
|
||||
blkpg->op = 3;
|
||||
blkpg->flags = 0xdeadbeef;
|
||||
blkpg->datalen = 0xbadc0ded;
|
||||
@ -156,7 +156,7 @@ main(void)
|
||||
"BLKPG_RESIZE_PARTITION", blkpg->flags, blkpg->datalen,
|
||||
(unsigned long) blkpg->data);
|
||||
|
||||
struct blkpg_partition *const bp = tail_alloc(sizeof(*bp));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct blkpg_partition, bp);
|
||||
bp->start = 0xfac1fed2dad3bef4ULL;
|
||||
bp->length = 0xfac5fed6dad7bef8ULL;
|
||||
bp->pno = magic;
|
||||
@ -177,7 +177,7 @@ main(void)
|
||||
(int) sizeof(bp->volname) - 1, bp->volname);
|
||||
|
||||
#if defined BLKTRACESETUP && defined HAVE_STRUCT_BLK_USER_TRACE_SETUP
|
||||
struct blk_user_trace_setup *const buts = tail_alloc(sizeof(*buts));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct blk_user_trace_setup, buts);
|
||||
fill_memory(buts, sizeof(*buts));
|
||||
|
||||
ioctl(-1, BLKTRACESETUP, buts);
|
||||
|
@ -148,7 +148,7 @@ main(void)
|
||||
void *const page = tail_alloc(size);
|
||||
fill_memory(page, size);
|
||||
|
||||
int *const val_int = tail_alloc(sizeof(*val_int));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(int, val_int);
|
||||
*val_int = magic;
|
||||
|
||||
# ifdef EVIOCSCLOCKID
|
||||
@ -172,7 +172,7 @@ main(void)
|
||||
pair_int[0], "KEY_ESC");
|
||||
|
||||
# ifdef EVIOCSKEYCODE_V2
|
||||
struct input_keymap_entry *const ike = tail_alloc(sizeof(*ike));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct input_keymap_entry, ike);
|
||||
fill_memory(ike, sizeof(*ike));
|
||||
ike->keycode = 2;
|
||||
|
||||
@ -196,7 +196,7 @@ main(void)
|
||||
printf("}) = -1 EBADF (%m)\n");
|
||||
# endif
|
||||
|
||||
struct ff_effect *const ffe = tail_alloc(sizeof(*ffe));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct ff_effect, ffe);
|
||||
fill_memory(ffe, sizeof(*ffe));
|
||||
|
||||
ffe->type = FF_CONSTANT;
|
||||
|
@ -175,8 +175,8 @@ main(void)
|
||||
static const kernel_ulong_t kernel_mask =
|
||||
((kernel_ulong_t) -1) - ((unsigned long) -1L);
|
||||
|
||||
struct loop_info * const info = tail_alloc(sizeof(*info));
|
||||
struct loop_info64 * const info64 = tail_alloc(sizeof(*info64));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct loop_info, info);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct loop_info64, info64);
|
||||
|
||||
/* Unknown loop commands */
|
||||
ioctl(-1, unknown_loop_cmd, magic);
|
||||
|
@ -95,13 +95,13 @@ main(void)
|
||||
ioctl(-1, MTDFILEMODE, MTD_FILE_MODE_NORMAL);
|
||||
printf("ioctl(-1, MTDFILEMODE, MTD_FILE_MODE_NORMAL) = -1 EBADF (%m)\n");
|
||||
|
||||
int *const opt = tail_alloc(sizeof(*opt));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(int, opt);
|
||||
*opt = MTD_OTP_OFF;
|
||||
ioctl(-1, OTPSELECT, opt);
|
||||
printf("ioctl(-1, MIXER_READ(%u) or OTPSELECT, [MTD_OTP_OFF])"
|
||||
" = -1 EBADF (%m)\n", (unsigned int) _IOC_NR(OTPSELECT));
|
||||
|
||||
uint64_t *const v64 = tail_alloc(sizeof(*v64));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(uint64_t, v64);
|
||||
fill_memory(v64, sizeof(*v64));
|
||||
|
||||
ioctl(-1, MEMGETBADBLOCK, v64);
|
||||
@ -114,7 +114,7 @@ main(void)
|
||||
" = -1 EBADF (%m)\n",
|
||||
(unsigned int) _IOC_NR(MEMSETBADBLOCK), *v64);
|
||||
|
||||
struct region_info_user *const riu = tail_alloc(sizeof(*riu));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct region_info_user, riu);
|
||||
fill_memory(riu, sizeof(*riu));
|
||||
ioctl(-1, MEMGETREGIONINFO, riu);
|
||||
printf("ioctl(-1, %s, {regionindex=%#x}) = -1 EBADF (%m)\n",
|
||||
@ -124,7 +124,7 @@ main(void)
|
||||
#endif
|
||||
, riu->regionindex);
|
||||
|
||||
struct erase_info_user *const eiu = tail_alloc(sizeof(*eiu));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct erase_info_user, eiu);
|
||||
fill_memory(eiu, sizeof(*eiu));
|
||||
|
||||
TEST_erase_info_user(MEMERASE, eiu);
|
||||
@ -132,7 +132,7 @@ main(void)
|
||||
TEST_erase_info_user(MEMUNLOCK, eiu);
|
||||
TEST_erase_info_user(MEMISLOCKED, eiu);
|
||||
|
||||
struct erase_info_user64 *const eiu64 = tail_alloc(sizeof(*eiu64));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct erase_info_user64, eiu64);
|
||||
fill_memory(eiu64, sizeof(*eiu64));
|
||||
ioctl(-1, MEMERASE64, eiu64);
|
||||
printf("ioctl(-1, MIXER_WRITE(%u) or %s, {start=%#llx, length=%#llx})"
|
||||
@ -141,7 +141,7 @@ main(void)
|
||||
(unsigned long long) eiu64->start,
|
||||
(unsigned long long) eiu64->length);
|
||||
|
||||
struct mtd_oob_buf *const oob = tail_alloc(sizeof(*oob));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct mtd_oob_buf, oob);
|
||||
fill_memory(oob, sizeof(*oob));
|
||||
|
||||
ioctl(-1, MEMWRITEOOB, oob);
|
||||
@ -152,7 +152,7 @@ main(void)
|
||||
printf("ioctl(-1, MEMREADOOB, {start=%#x, length=%#x, ptr=%p})"
|
||||
" = -1 EBADF (%m)\n", oob->start, oob->length, oob->ptr);
|
||||
|
||||
struct mtd_oob_buf64 *const oob64 = tail_alloc(sizeof(*oob64));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct mtd_oob_buf64, oob64);
|
||||
fill_memory(oob64, sizeof(*oob64));
|
||||
|
||||
ioctl(-1, MEMWRITEOOB64, oob64);
|
||||
@ -168,14 +168,14 @@ main(void)
|
||||
(unsigned long long) oob64->usr_ptr);
|
||||
|
||||
|
||||
struct otp_info *const oi = tail_alloc(sizeof(*oi));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct otp_info, oi);
|
||||
fill_memory(oi, sizeof(*oi));
|
||||
ioctl(-1, OTPLOCK, oi);
|
||||
printf("ioctl(-1, MIXER_READ(%u) or OTPLOCK"
|
||||
", {start=%#x, length=%#x, locked=%u}) = -1 EBADF (%m)\n",
|
||||
(unsigned int) _IOC_NR(OTPLOCK), oi->start, oi->length, oi->locked);
|
||||
|
||||
struct mtd_write_req *const wr = tail_alloc(sizeof(*wr));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct mtd_write_req, wr);
|
||||
fill_memory(wr, sizeof(*wr));
|
||||
wr->mode = MTD_OPS_PLACE_OOB;
|
||||
ioctl(-1, MEMWRITE, wr);
|
||||
|
@ -73,13 +73,13 @@ main(void)
|
||||
void *const page = tail_alloc(size);
|
||||
fill_memory(page, size);
|
||||
|
||||
struct rtc_time *rt = tail_alloc(sizeof(*rt));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct rtc_time, rt);
|
||||
fill_memory(rt, sizeof(*rt));
|
||||
|
||||
struct rtc_wkalrm *wk = tail_alloc(sizeof(*wk));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct rtc_wkalrm, wk);
|
||||
fill_memory(wk, sizeof(*wk));
|
||||
|
||||
struct rtc_pll_info *pll = tail_alloc(sizeof(*pll));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct rtc_pll_info, pll);
|
||||
fill_memory(pll, sizeof(*pll));
|
||||
|
||||
/* RTC_ALM_READ */
|
||||
|
@ -69,7 +69,7 @@
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int *const pint = tail_alloc(sizeof(*pint));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(int, pint);
|
||||
*pint = (int) 0xfacefeed;
|
||||
|
||||
TEST_NO_ARG(SG_GET_TIMEOUT);
|
||||
|
@ -43,7 +43,7 @@ main(void)
|
||||
ioctl(-1, SG_IO, 0);
|
||||
printf("ioctl(-1, SG_IO, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
struct sg_io_hdr *const sg_io = tail_alloc(sizeof(*sg_io));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct sg_io_hdr, sg_io);
|
||||
fill_memory(sg_io, sizeof(*sg_io));
|
||||
|
||||
const void *const efault = sg_io + 1;
|
||||
@ -53,7 +53,7 @@ main(void)
|
||||
ioctl(-1, SG_IO, sg_io);
|
||||
printf("ioctl(-1, SG_IO, [%u]) = -1 EBADF (%m)\n", sg_io->interface_id);
|
||||
|
||||
unsigned int *const piid = tail_alloc(sizeof(*piid));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(unsigned int, piid);
|
||||
*piid = (unsigned char) 'S';
|
||||
ioctl(-1, SG_IO, piid);
|
||||
printf("ioctl(-1, SG_IO, {interface_id='S', %p}) = -1 EBADF (%m)\n", piid + 1);
|
||||
|
@ -45,7 +45,7 @@ main(void)
|
||||
ioctl(-1, SG_IO, 0);
|
||||
printf("ioctl(-1, SG_IO, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
struct sg_io_v4 *const sg_io = tail_alloc(sizeof(*sg_io));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct sg_io_v4, sg_io);
|
||||
fill_memory(sg_io, sizeof(*sg_io));
|
||||
|
||||
const void *const efault = sg_io + 1;
|
||||
@ -55,7 +55,7 @@ main(void)
|
||||
ioctl(-1, SG_IO, sg_io);
|
||||
printf("ioctl(-1, SG_IO, [%u]) = -1 EBADF (%m)\n", sg_io->guard);
|
||||
|
||||
unsigned int *const pguard = tail_alloc(sizeof(*pguard));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(unsigned int, pguard);
|
||||
*pguard = (unsigned char) 'Q';
|
||||
ioctl(-1, SG_IO, pguard);
|
||||
printf("ioctl(-1, SG_IO, {guard='Q', %p}) = -1 EBADF (%m)\n", pguard + 1);
|
||||
|
@ -134,7 +134,7 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
struct ifreq *ifr = tail_alloc(2 * sizeof(*ifr));
|
||||
struct ifconf *ifc = tail_alloc(sizeof(*ifc));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct ifconf, ifc);
|
||||
|
||||
struct sockaddr_in addr;
|
||||
int fd;
|
||||
|
@ -54,7 +54,7 @@ main(void)
|
||||
perror_msg_and_skip("userfaultfd");
|
||||
|
||||
/* ---- API ---- */
|
||||
struct uffdio_api *api_struct = tail_alloc(sizeof(*api_struct));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct uffdio_api, api_struct);
|
||||
|
||||
/* With a bad fd */
|
||||
memset(api_struct, 0, sizeof(*api_struct));
|
||||
@ -127,7 +127,7 @@ main(void)
|
||||
* userfaultfd will cause us to stall.
|
||||
*/
|
||||
/* ---- COPY ---- */
|
||||
struct uffdio_copy *copy_struct = tail_alloc(sizeof(*copy_struct));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct uffdio_copy, copy_struct);
|
||||
|
||||
memset(copy_struct, 0, sizeof(*copy_struct));
|
||||
rc = ioctl(-1, UFFDIO_COPY, copy_struct);
|
||||
@ -148,7 +148,7 @@ main(void)
|
||||
fd, area2, area1, pagesize, pagesize, rc);
|
||||
|
||||
/* ---- ZEROPAGE ---- */
|
||||
struct uffdio_zeropage *zero_struct = tail_alloc(sizeof(*zero_struct));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct uffdio_zeropage, zero_struct);
|
||||
madvise(area2, pagesize, MADV_DONTNEED);
|
||||
|
||||
memset(zero_struct, 0, sizeof(*zero_struct));
|
||||
@ -169,7 +169,7 @@ main(void)
|
||||
fd, area2, pagesize, pagesize, rc);
|
||||
|
||||
/* ---- WAKE ---- */
|
||||
struct uffdio_range *range_struct = tail_alloc(sizeof(*range_struct));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct uffdio_range, range_struct);
|
||||
memset(range_struct, 0, sizeof(*range_struct));
|
||||
|
||||
rc = ioctl(-1, UFFDIO_WAKE, range_struct);
|
||||
|
@ -76,7 +76,7 @@ main(void )
|
||||
ioctl(-1, VIDIOC_ENUM_FMT, 0);
|
||||
printf("ioctl(-1, VIDIOC_ENUM_FMT, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
struct v4l2_fmtdesc *const p_fmtdesc = tail_alloc(sizeof(*p_fmtdesc));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct v4l2_fmtdesc, p_fmtdesc);
|
||||
p_fmtdesc->index = magic;
|
||||
p_fmtdesc->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
ioctl(-1, VIDIOC_ENUM_FMT, p_fmtdesc);
|
||||
@ -88,7 +88,7 @@ main(void )
|
||||
ioctl(-1, VIDIOC_G_FMT, 0);
|
||||
printf("ioctl(-1, VIDIOC_G_FMT, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
struct v4l2_format *const p_format = tail_alloc(sizeof(*p_format));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct v4l2_format, p_format);
|
||||
p_format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
|
||||
ioctl(-1, VIDIOC_G_FMT, p_format);
|
||||
|
@ -44,8 +44,8 @@ main(void)
|
||||
static const char multi6addr[] = "ff01::c";
|
||||
static const char interface[] = "127.0.0.1";
|
||||
|
||||
struct ip_mreq *const m4 = tail_alloc(sizeof(*m4));
|
||||
struct ipv6_mreq *const m6 = tail_alloc(sizeof(*m6));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct ip_mreq, m4);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct ipv6_mreq, m6);
|
||||
unsigned int i;
|
||||
int rc;
|
||||
|
||||
|
@ -242,7 +242,7 @@ main(void)
|
||||
kernel_long_t *bogus_attrs = tail_alloc(sizeof(*bogus_attrs) *
|
||||
NUM_ATTRS);
|
||||
char *msg = tail_alloc(MSG_SIZE);
|
||||
unsigned *bogus_prio_ptr = tail_alloc(sizeof(*bogus_prio_ptr));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(unsigned, bogus_prio_ptr);
|
||||
struct timespec *bogus_tmout = tail_memdup(&bogus_tmout_data,
|
||||
sizeof(*bogus_tmout));
|
||||
struct timespec *future_tmout = tail_memdup(&future_tmout_data,
|
||||
|
@ -689,7 +689,7 @@ int main(int ac, const char **av)
|
||||
int rc = sendmsg(-1, 0, 0);
|
||||
printf("sendmsg(-1, NULL, 0) = %d %s (%m)\n", rc, errno2name());
|
||||
|
||||
struct msghdr *mh = tail_alloc(sizeof(*mh));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct msghdr, mh);
|
||||
memset(mh, 0, sizeof(*mh));
|
||||
test_big_len(mh);
|
||||
|
||||
|
@ -47,13 +47,13 @@ send_recv(const int send_fd, const int recv_fd,
|
||||
static void
|
||||
test_msg_name(const int send_fd, const int recv_fd)
|
||||
{
|
||||
char *const recv_buf = tail_alloc(sizeof(*recv_buf));
|
||||
struct iovec *const iov = tail_alloc(sizeof(*iov));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(char, recv_buf);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct iovec, iov);
|
||||
iov->iov_base = recv_buf;
|
||||
iov->iov_len = sizeof(*recv_buf);
|
||||
|
||||
struct sockaddr_un *const addr = tail_alloc(sizeof(*addr));
|
||||
struct msghdr *const msg = tail_alloc(sizeof(*msg));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct sockaddr_un, addr);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct msghdr, msg);
|
||||
msg->msg_name = addr;
|
||||
msg->msg_namelen = sizeof(*addr);
|
||||
msg->msg_iov = iov;
|
||||
|
@ -43,9 +43,9 @@ main(void)
|
||||
printf("setsockopt(-1, SOL_RAW, ICMP_FILTER, NULL, 0) = -1 %s (%m)\n",
|
||||
errno2name());
|
||||
|
||||
socklen_t *const plen = tail_alloc(sizeof(*plen));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(socklen_t, plen);
|
||||
void *const efault = plen + 1;
|
||||
struct icmp_filter *const f = tail_alloc(sizeof(*f));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct icmp_filter, f);
|
||||
|
||||
getsockopt(-1, SOL_RAW, ICMP_FILTER, f, plen);
|
||||
printf("getsockopt(-1, SOL_RAW, ICMP_FILTER, %p, %p) = -1 %s (%m)\n",
|
||||
|
@ -49,7 +49,7 @@ main(int ac, const char **av)
|
||||
strncpy(addr.sun_path, av[1], sizeof(addr.sun_path));
|
||||
struct sockaddr * const listen_sa = tail_memdup(&addr, sizeof(addr));
|
||||
|
||||
socklen_t * const len = tail_alloc(sizeof(socklen_t));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(socklen_t, len);
|
||||
*len = offsetof(struct sockaddr_un, sun_path) + strlen(av[1]) + 1;
|
||||
if (*len > sizeof(addr))
|
||||
*len = sizeof(addr);
|
||||
@ -71,7 +71,7 @@ main(int ac, const char **av)
|
||||
perror_msg_and_skip("listen");
|
||||
printf("listen(%d<socket:[%lu]>, 1) = 0\n", listen_fd, listen_inode);
|
||||
|
||||
unsigned int * const optval = tail_alloc(sizeof(unsigned int));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(unsigned int, optval);
|
||||
*len = sizeof(*optval);
|
||||
if (getsockopt(listen_fd, SOL_SOCKET, SO_PASSCRED, optval, len))
|
||||
perror_msg_and_fail("getsockopt");
|
||||
|
@ -46,7 +46,7 @@ main(void)
|
||||
.sin_addr.s_addr = htonl(INADDR_LOOPBACK)
|
||||
};
|
||||
struct sockaddr * const listen_sa = tail_memdup(&addr, sizeof(addr));
|
||||
socklen_t * const len = tail_alloc(sizeof(socklen_t));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(socklen_t, len);
|
||||
*len = sizeof(addr);
|
||||
|
||||
const int listen_fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
@ -77,7 +77,7 @@ main(void)
|
||||
", [%u]) = 0\n",
|
||||
listen_fd, listen_port, listen_port, (unsigned) *len);
|
||||
|
||||
unsigned int * const optval = tail_alloc(sizeof(unsigned int));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(unsigned int, optval);
|
||||
*len = sizeof(*optval);
|
||||
if (getsockopt(listen_fd, SOL_TCP, TCP_MAXSEG, optval, len))
|
||||
perror_msg_and_fail("getsockopt");
|
||||
|
@ -53,7 +53,7 @@ main(void)
|
||||
.nl_pid = 1234
|
||||
};
|
||||
struct sockaddr *const sa = tail_memdup(&addr, sizeof(addr));
|
||||
socklen_t * const len = tail_alloc(sizeof(socklen_t));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(socklen_t, len);
|
||||
*len = sizeof(addr);
|
||||
|
||||
const int fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_SOCK_DIAG);
|
||||
|
@ -49,7 +49,7 @@ main(int ac, const char **av)
|
||||
strncpy(addr.sun_path, av[1], sizeof(addr.sun_path));
|
||||
struct sockaddr * const listen_sa = tail_memdup(&addr, sizeof(addr));
|
||||
|
||||
socklen_t * const len = tail_alloc(sizeof(socklen_t));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(socklen_t, len);
|
||||
*len = offsetof(struct sockaddr_un, sun_path) + strlen(av[1]) + 1;
|
||||
if (*len > sizeof(addr))
|
||||
*len = sizeof(addr);
|
||||
@ -72,7 +72,7 @@ main(int ac, const char **av)
|
||||
printf("listen(%d<UNIX:[%lu,\"%s\"]>, 1) = 0\n",
|
||||
listen_fd, listen_inode, av[1]);
|
||||
|
||||
unsigned int * const optval = tail_alloc(sizeof(unsigned int));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(unsigned int, optval);
|
||||
*len = sizeof(*optval);
|
||||
if (getsockopt(listen_fd, SOL_SOCKET, SO_PASSCRED, optval, len))
|
||||
perror_msg_and_fail("getsockopt");
|
||||
|
@ -681,7 +681,7 @@ main(void)
|
||||
ATTR_REC(attr_big_size),
|
||||
};
|
||||
|
||||
struct perf_event_attr *small_attr = tail_alloc(sizeof(*small_attr));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct perf_event_attr, small_attr);
|
||||
|
||||
struct {
|
||||
struct perf_event_attr *attr;
|
||||
|
@ -62,7 +62,7 @@ static const char *printaddr(void *ptr)
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
struct perf_event_attr *attr = tail_alloc(sizeof(*attr));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct perf_event_attr, attr);
|
||||
|
||||
attr->type = PERF_TYPE_HARDWARE;
|
||||
attr->size = sizeof(*attr);
|
||||
|
@ -65,7 +65,7 @@ main(void)
|
||||
static const char *const USR2_CHLD_str =
|
||||
(SIGUSR2 < SIGCHLD) ? "USR2 CHLD" : "CHLD USR2";
|
||||
void *const efault = tail_alloc(1024) + 1024;
|
||||
struct timespec *const ts = tail_alloc(sizeof(*ts));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct timespec, ts);
|
||||
const unsigned int sigset_size = get_sigset_size();
|
||||
void *const sigmask = tail_alloc(sigset_size);
|
||||
struct pollfd *fds;
|
||||
|
@ -70,7 +70,7 @@ main(void)
|
||||
{ 11, "PR_GET_FPEXC" },
|
||||
};
|
||||
|
||||
unsigned int *ptr = tail_alloc(sizeof(*ptr));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(unsigned int, ptr);
|
||||
long rc;
|
||||
unsigned int i;
|
||||
|
||||
|
@ -57,7 +57,7 @@ main(void)
|
||||
{ 32, "PR_TASK_PERF_EVENTS_ENABLE" },
|
||||
};
|
||||
|
||||
unsigned int *ptr = tail_alloc(sizeof(*ptr));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(unsigned int, ptr);
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(options); i++) {
|
||||
|
@ -44,7 +44,7 @@ main(void)
|
||||
static const kernel_ulong_t bogus_signal =
|
||||
(kernel_ulong_t) 0xbadc0deddeadfeedULL;
|
||||
|
||||
int *pdeathsig = tail_alloc(sizeof(*pdeathsig));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(int, pdeathsig);
|
||||
long rc;
|
||||
|
||||
rc = syscall(__NR_prctl, PR_SET_PDEATHSIG, bogus_signal);
|
||||
|
@ -59,7 +59,7 @@ main(void)
|
||||
(kernel_ulong_t) 0xfffffffffffffffdULL;
|
||||
|
||||
/* Note that kernel puts kernel-sized pointer even on x32 */
|
||||
kernel_ulong_t *ptr = tail_alloc(sizeof(*ptr));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(kernel_ulong_t, ptr);
|
||||
long rc;
|
||||
long set_ok;
|
||||
|
||||
|
@ -43,7 +43,7 @@ main(void)
|
||||
static const kernel_ulong_t bogus_tsc =
|
||||
(kernel_ulong_t) 0xdeadc0defacebeefULL;
|
||||
|
||||
int *tsc = tail_alloc(sizeof(*tsc));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(int, tsc);
|
||||
long rc;
|
||||
|
||||
rc = syscall(__NR_prctl, PR_SET_TSC, 0);
|
||||
|
@ -66,7 +66,7 @@ main(void)
|
||||
{
|
||||
const off_t offset = 0xdefaceddeadbeefLL;
|
||||
char *buf = tail_alloc(LEN);
|
||||
struct iovec *iov = tail_alloc(sizeof(*iov));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct iovec, iov);
|
||||
iov->iov_base = buf;
|
||||
iov->iov_len = LEN;
|
||||
|
||||
|
@ -179,7 +179,7 @@ main(void)
|
||||
const unsigned int sigset_size = get_sigset_size();
|
||||
|
||||
void *const k_set = tail_alloc(sigset_size);
|
||||
siginfo_t *const sip = tail_alloc(sizeof(*sip));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(siginfo_t, sip);
|
||||
|
||||
do_ptrace(bad_request, pid, 0, 0);
|
||||
printf("ptrace(%#lx /* PTRACE_??? */, %u, NULL, NULL) = %s\n",
|
||||
|
@ -207,10 +207,10 @@ main(void)
|
||||
char unterminated_str[sizeof(void *) * 2 + sizeof("0x")];
|
||||
|
||||
long rc;
|
||||
struct fs_disk_quota *xdq = tail_alloc(sizeof(*xdq));
|
||||
struct fs_quota_stat *xqstat = tail_alloc(sizeof(*xqstat));
|
||||
struct fs_quota_statv *xqstatv = tail_alloc(sizeof(*xqstatv));
|
||||
uint32_t *flags = tail_alloc(sizeof(*flags));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct fs_disk_quota, xdq);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct fs_quota_stat, xqstat);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct fs_quota_statv, xqstatv);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(uint32_t, flags);
|
||||
char *unterminated = tail_memdup(unterminated_data,
|
||||
sizeof(unterminated_data));
|
||||
|
||||
|
@ -173,10 +173,10 @@ main(void)
|
||||
long rc;
|
||||
char *unterminated = tail_memdup(unterminated_data,
|
||||
sizeof(unterminated_data));
|
||||
struct if_dqblk *dqblk = tail_alloc(sizeof(*dqblk));
|
||||
struct if_dqinfo *dqinfo = tail_alloc(sizeof(*dqinfo));
|
||||
uint32_t *fmt = tail_alloc(sizeof(*fmt));
|
||||
struct if_nextdqblk *nextdqblk = tail_alloc(sizeof(*nextdqblk));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct if_dqblk, dqblk);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct if_dqinfo, dqinfo);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(uint32_t, fmt);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct if_nextdqblk, nextdqblk);
|
||||
|
||||
|
||||
snprintf(bogus_special_str, sizeof(bogus_special_str), "%p",
|
||||
|
@ -78,7 +78,7 @@ main(void)
|
||||
|
||||
const unsigned int big_size = 1024 / 8;
|
||||
void *k_set = tail_alloc(big_size);
|
||||
sigset_t *const libc_set = tail_alloc(sizeof(sigset_t));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(sigset_t, libc_set);
|
||||
|
||||
sigemptyset(libc_set);
|
||||
if (sigprocmask(SIG_SETMASK, libc_set, NULL))
|
||||
|
@ -91,7 +91,7 @@ main(void)
|
||||
|
||||
void *const k_set = tail_alloc(set_size);
|
||||
void *const old_set = tail_alloc(set_size);
|
||||
sigset_t *const libc_set = tail_alloc(sizeof(sigset_t));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(sigset_t, libc_set);
|
||||
|
||||
memset(k_set, 0, set_size);
|
||||
if (k_sigprocmask(SIG_SETMASK, k_set, NULL, set_size))
|
||||
|
@ -88,7 +88,7 @@ main(void)
|
||||
void *k_set = tail_alloc(big_size);
|
||||
memset(k_set, 0, big_size);
|
||||
|
||||
sigset_t *const libc_set = tail_alloc(sizeof(sigset_t));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(sigset_t, libc_set);
|
||||
sigemptyset(libc_set);
|
||||
sigaddset(libc_set, SIGUSR1);
|
||||
if (sigprocmask(SIG_SETMASK, libc_set, NULL))
|
||||
|
@ -86,8 +86,8 @@ main(void)
|
||||
{
|
||||
tprintf("%s", "");
|
||||
|
||||
siginfo_t *const info = tail_alloc(sizeof(*info));
|
||||
struct timespec *const timeout = tail_alloc(sizeof(*timeout));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(siginfo_t, info);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct timespec, timeout);
|
||||
timeout->tv_sec = 0;
|
||||
timeout->tv_nsec = 42;
|
||||
|
||||
@ -111,7 +111,7 @@ main(void)
|
||||
(intmax_t) timeout->tv_sec, (intmax_t) timeout->tv_nsec,
|
||||
set_size);
|
||||
|
||||
sigset_t *const libc_set = tail_alloc(sizeof(sigset_t));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(sigset_t, libc_set);
|
||||
sigemptyset(libc_set);
|
||||
sigaddset(libc_set, SIGHUP);
|
||||
memcpy(k_set, libc_set, set_size);
|
||||
|
@ -57,7 +57,7 @@ main (void)
|
||||
if (sigaction(SIGUSR1, &sa, NULL))
|
||||
perror_msg_and_fail("sigaction");
|
||||
|
||||
siginfo_t *const info = tail_alloc(sizeof(*info));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(siginfo_t, info);
|
||||
memset(info, 0, sizeof(*info));
|
||||
info->si_signo = SIGUSR1;
|
||||
info->si_errno = ENOENT;
|
||||
|
@ -11,7 +11,7 @@
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
struct timespec *const tp = tail_alloc(sizeof(struct timespec));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct timespec, tp);
|
||||
long rc;
|
||||
|
||||
rc = syscall(__NR_sched_rr_get_interval, 0, NULL);
|
||||
|
@ -67,8 +67,8 @@ main(void)
|
||||
static const kernel_ulong_t bogus_flags =
|
||||
(kernel_ulong_t) 0xdefaceddeadc0deULL;
|
||||
|
||||
struct sched_attr *const attr = tail_alloc(sizeof(*attr));
|
||||
unsigned int *const psize = tail_alloc(sizeof(*psize));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct sched_attr, attr);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(unsigned int, psize);
|
||||
void *const efault = attr + 1;
|
||||
|
||||
sys_sched_getattr(0, 0, 0, 0);
|
||||
|
@ -10,7 +10,7 @@
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
struct sched_param *const param = tail_alloc(sizeof(struct sched_param));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct sched_param, param);
|
||||
long rc = syscall(__NR_sched_getscheduler, 0);
|
||||
const char *scheduler;
|
||||
switch (rc) {
|
||||
|
@ -44,11 +44,11 @@ int main(int ac, const char **av)
|
||||
void *data = tail_alloc(data_size);
|
||||
memcpy(data, sample, data_size);
|
||||
|
||||
struct iovec *iov = tail_alloc(sizeof(struct iovec));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct iovec, iov);
|
||||
iov->iov_base = data;
|
||||
iov->iov_len = data_size;
|
||||
|
||||
struct msghdr *mh = tail_alloc(sizeof(struct msghdr));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct msghdr, mh);
|
||||
memset(mh, 0, sizeof(*mh));
|
||||
mh->msg_iov = iov;
|
||||
mh->msg_iovlen = 1;
|
||||
|
@ -105,7 +105,7 @@ main(void)
|
||||
tail_memdup(filter_c, sizeof(filter_c));
|
||||
struct sock_filter *const big_filter =
|
||||
tail_alloc(sizeof(*big_filter) * (BPF_MAXINSNS + 1));
|
||||
struct sock_fprog *const prog = tail_alloc(sizeof(*prog));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct sock_fprog, prog);
|
||||
|
||||
int fds[2];
|
||||
if (pipe(fds))
|
||||
|
@ -49,7 +49,7 @@ main(void)
|
||||
{
|
||||
struct sock_filter *const filter = tail_alloc(sizeof(*filter) * N);
|
||||
const void *const efault = tail_alloc(1);
|
||||
struct sock_fprog *const prog = tail_alloc(sizeof(*prog));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct sock_fprog, prog);
|
||||
long rc;
|
||||
|
||||
prog->filter = filter;
|
||||
|
@ -47,8 +47,8 @@ main(void)
|
||||
if (semctl(id, 0, SETVAL, sem_union) == -1)
|
||||
perror_msg_and_skip("semctl");
|
||||
|
||||
struct sembuf *const sem_b = tail_alloc(sizeof(*sem_b));
|
||||
struct sembuf *const sem_b2 = tail_alloc(sizeof(*sem_b2));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct sembuf, sem_b);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct sembuf, sem_b2);
|
||||
|
||||
rc = semop(bogus_semid, NULL, bogus_nsops);
|
||||
printf("semop(%d, NULL, %u) = %s\n",
|
||||
|
@ -69,7 +69,7 @@ main(int ac, const char **av)
|
||||
printf("sendfile64(0, 1, NULL, %lu) = -1 EBADF (%m)\n",
|
||||
(unsigned long) page_len);
|
||||
|
||||
uint64_t *p_off = tail_alloc(sizeof(uint64_t));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(uint64_t, p_off);
|
||||
void *p = p_off + 1;
|
||||
*p_off = 0;
|
||||
|
||||
|
@ -91,7 +91,7 @@ main(void)
|
||||
printf("%s(%d, NULL) = %s\n", SYSCALL_NAME, -1, sprintrc(rc));
|
||||
|
||||
/* check how the second argument is decoded */
|
||||
const GID_TYPE *const g1 = tail_alloc(sizeof(*g1));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(const GID_TYPE, g1);
|
||||
GID_TYPE *const g2 = tail_alloc(sizeof(*g2) * 2);
|
||||
GID_TYPE *const g3 = tail_alloc(sizeof(*g3) * 3);
|
||||
|
||||
|
@ -74,7 +74,7 @@
|
||||
static void
|
||||
test_sockname_syscall(const int fd)
|
||||
{
|
||||
socklen_t *const plen = tail_alloc(sizeof(*plen));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(socklen_t, plen);
|
||||
*plen = sizeof(struct sockaddr_un);
|
||||
struct sockaddr_un *addr = tail_alloc(*plen);
|
||||
|
||||
|
@ -40,8 +40,8 @@ main(void)
|
||||
{
|
||||
const long int fd_in = (long int) 0xdeadbeefffffffffULL;
|
||||
const long int fd_out = (long int) 0xdeadbeeffffffffeULL;
|
||||
long long int *const off_in = tail_alloc(sizeof(*off_in));
|
||||
long long int *const off_out = tail_alloc(sizeof(*off_out));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(long long int, off_in);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(long long int, off_out);
|
||||
*off_in = 0xdeadbef1facefed1ULL;
|
||||
*off_out = 0xdeadbef2facefed2ULL;
|
||||
const size_t len = (size_t) 0xdeadbef3facefed3ULL;
|
||||
|
@ -38,7 +38,7 @@ main(void)
|
||||
sysinfo(NULL);
|
||||
printf("sysinfo(NULL) = -1 EFAULT (%m)\n");
|
||||
|
||||
struct sysinfo * const si = tail_alloc(sizeof(*si));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct sysinfo, si);
|
||||
|
||||
if (sysinfo(si))
|
||||
perror_msg_and_skip("sysinfo");
|
||||
|
@ -40,7 +40,7 @@
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
time_t *p = tail_alloc(sizeof(time_t));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(time_t, p);
|
||||
|
||||
time_t t = syscall(__NR_time, NULL);
|
||||
if ((time_t) -1 == t)
|
||||
|
@ -10,7 +10,7 @@
|
||||
int main(int ac, char **av)
|
||||
{
|
||||
int abbrev = ac > 1;
|
||||
struct utsname *const uname = tail_alloc(sizeof(struct utsname));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct utsname, uname);
|
||||
int rc = syscall(__NR_uname, uname);
|
||||
printf("uname({sysname=\"");
|
||||
print_quoted_string(uname->sysname);
|
||||
|
@ -47,7 +47,7 @@ main(void)
|
||||
long rc;
|
||||
|
||||
# ifdef HAVE_USTAT_H
|
||||
struct ustat *const ust = tail_alloc(sizeof(*ust));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct ustat, ust);
|
||||
struct stat st;
|
||||
if (stat(".", &st))
|
||||
perror_msg_and_fail("stat");
|
||||
|
@ -119,12 +119,12 @@ main(void)
|
||||
|
||||
(void) close(0);
|
||||
|
||||
int *const s = tail_alloc(sizeof(*s));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(int, s);
|
||||
if (wait4(pid, s, WNOHANG|__WALL, NULL))
|
||||
perror_msg_and_fail("wait4 #1");
|
||||
tprintf("wait4(%d, %p, WNOHANG|__WALL, NULL) = 0\n", pid, s);
|
||||
|
||||
struct rusage *const rusage = tail_alloc(sizeof(*rusage));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct rusage, rusage);
|
||||
if (wait4(pid, s, WNOHANG|__WALL, rusage))
|
||||
perror_msg_and_fail("wait4 #2");
|
||||
tprintf("wait4(%d, %p, WNOHANG|__WALL, %p) = 0\n", pid, s, rusage);
|
||||
|
@ -185,9 +185,9 @@ main(void)
|
||||
perror_msg_and_fail("waitid #1");
|
||||
tprintf("waitid(P_PID, %d, NULL, WNOHANG|WEXITED, NULL) = 0\n", pid);
|
||||
|
||||
siginfo_t *const sinfo = tail_alloc(sizeof(*sinfo));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(siginfo_t, sinfo);
|
||||
memset(sinfo, 0, sizeof(*sinfo));
|
||||
struct rusage *const rusage = tail_alloc(sizeof(*rusage));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct rusage, rusage);
|
||||
if (do_waitid(P_PID, pid, sinfo, WNOHANG|WEXITED|WSTOPPED, rusage))
|
||||
perror_msg_and_fail("waitid #2");
|
||||
tprintf("waitid(P_PID, %d, {}, WNOHANG|WEXITED|WSTOPPED, %s) = 0\n",
|
||||
|
@ -51,8 +51,8 @@ main(void)
|
||||
{
|
||||
const pid_t pid = getpid();
|
||||
const long long_pid = (unsigned long) (0xdeadbeef00000000LL | pid);
|
||||
void **p_head = tail_alloc(sizeof(void *));
|
||||
size_t *p_len = tail_alloc(sizeof(size_t));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(void *, p_head);
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(size_t, p_len);
|
||||
|
||||
if (syscall(__NR_get_robust_list, long_pid, p_head, p_len))
|
||||
perror_msg_and_skip("get_robust_list");
|
||||
|
@ -46,7 +46,7 @@ main(void)
|
||||
static const kernel_ulong_t bogus_timer =
|
||||
(kernel_ulong_t) 0xfacefeeddeadbeefULL;
|
||||
|
||||
struct itimerval *const p_old = tail_alloc(sizeof(*p_old));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(struct itimerval, p_old);
|
||||
struct itimerval *const p_new = tail_memdup(&new, sizeof(new));
|
||||
void *const efault = tail_alloc(sizeof(new) - 8);
|
||||
long rc;
|
||||
|
@ -64,7 +64,7 @@ print_statfs(const char *const sample, const char *magic_str)
|
||||
if (fd < 0)
|
||||
perror_msg_and_fail("open: %s", sample);
|
||||
|
||||
STRUCT_STATFS *const b = tail_alloc(sizeof(*b));
|
||||
TAIL_ALLOC_OBJECT_CONST_PTR(STRUCT_STATFS, b);
|
||||
long rc = SYSCALL_INVOKE(sample, fd, b, sizeof(*b));
|
||||
if (rc)
|
||||
perror_msg_and_skip(SYSCALL_NAME);
|
||||
|
Loading…
x
Reference in New Issue
Block a user