[PATCH 1/3] linux/32: Split 32-bit time_t syscalls into a seperate header

Dmitry V. Levin ldv at altlinux.org
Wed Feb 26 02:30:08 UTC 2020


On Fri, Feb 14, 2020 at 11:40:26AM -0800, Alistair Francis wrote:
> Signed-off-by: Alistair Francis <alistair.francis at wdc.com>
> ---
>  linux/32/syscallent.h            | 26 +++-----------------------
>  linux/syscallent-common-time32.h | 30 ++++++++++++++++++++++++++++++
>  2 files changed, 33 insertions(+), 23 deletions(-)
>  create mode 100644 linux/syscallent-common-time32.h
> 
> diff --git a/linux/32/syscallent.h b/linux/32/syscallent.h
> index c40d89dd..633f4693 100644
> --- a/linux/32/syscallent.h
> +++ b/linux/32/syscallent.h
> @@ -12,7 +12,6 @@
>  [  1] = { 1,	TM,		SEN(io_destroy),		"io_destroy"		},
>  [  2] = { 3,	0,		SEN(io_submit),			"io_submit"		},
>  [  3] = { 3,	0,		SEN(io_cancel),			"io_cancel"		},
> -[  4] = { 5,	0,		SEN(io_getevents_time32),	"io_getevents"		},
>  [  5] = { 5,	TF,		SEN(setxattr),			"setxattr"		},
>  [  6] = { 5,	TF,		SEN(setxattr),			"lsetxattr"		},
>  [  7] = { 5,	TD,		SEN(fsetxattr),			"fsetxattr"		},
> @@ -80,8 +79,6 @@
>  [ 69] = { 5,	TD,		SEN(preadv),			"preadv"		},
>  [ 70] = { 5,	TD,		SEN(pwritev),			"pwritev"		},
>  [ 71] = { 4,	TD|TN,		SEN(sendfile64),		"sendfile64"		},
> -[ 72] = { 6,	TD,		SEN(pselect6_time32),		"pselect6"		},
> -[ 73] = { 5,	TD,		SEN(ppoll_time32),		"ppoll"			},
>  [ 74] = { 4,	TD|TS,		SEN(signalfd4),			"signalfd4"		},
>  [ 75] = { 4,	TD,		SEN(vmsplice),			"vmsplice"		},
>  [ 76] = { 6,	TD,		SEN(splice),			"splice"		},
> @@ -98,9 +95,6 @@
>  [ 84] = { 6,	TD,		SEN(sync_file_range),		"sync_file_range"	},
>  #endif
>  [ 85] = { 2,	TD,		SEN(timerfd_create),		"timerfd_create"	},
> -[ 86] = { 4,	TD,		SEN(timerfd_settime32),		"timerfd_settime"	},
> -[ 87] = { 2,	TD,		SEN(timerfd_gettime32),		"timerfd_gettime"	},
> -[ 88] = { 4,	TD|TF,		SEN(utimensat_time32),		"utimensat"		},
>  [ 89] = { 1,	TF,		SEN(acct),			"acct"			},
>  [ 90] = { 2,	TC,		SEN(capget),			"capget"		},
>  [ 91] = { 2,	TC,		SEN(capset),			"capset"		},
> @@ -110,24 +104,16 @@
>  [ 95] = { 5,	TP,		SEN(waitid),			"waitid"		},
>  [ 96] = { 1,	0,		SEN(set_tid_address),		"set_tid_address"	},
>  [ 97] = { 1,	TP,		SEN(unshare),			"unshare"		},
> -[ 98] = { 6,	0,		SEN(futex_time32),		"futex"			},
>  [ 99] = { 2,	0,		SEN(set_robust_list),		"set_robust_list"	},
>  [100] = { 3,	0,		SEN(get_robust_list),		"get_robust_list"	},
> -[101] = { 2,	0,		SEN(nanosleep_time32),		"nanosleep"		},
>  [102] = { 2,	0,		SEN(getitimer),			"getitimer"		},
>  [103] = { 3,	0,		SEN(setitimer),			"setitimer"		},
>  [104] = { 4,	0,		SEN(kexec_load),		"kexec_load"		},
>  [105] = { 3,	0,		SEN(init_module),		"init_module"		},
>  [106] = { 2,	0,		SEN(delete_module),		"delete_module"		},
>  [107] = { 3,	0,		SEN(timer_create),		"timer_create"		},
> -[108] = { 2,	0,		SEN(timer_gettime32),		"timer_gettime"		},
>  [109] = { 1,	0,		SEN(timer_getoverrun),		"timer_getoverrun"	},
> -[110] = { 4,	0,		SEN(timer_settime32),		"timer_settime"		},
>  [111] = { 1,	0,		SEN(timer_delete),		"timer_delete"		},
> -[112] = { 2,	0,		SEN(clock_settime32),		"clock_settime"		},
> -[113] = { 2,	0,		SEN(clock_gettime32),		"clock_gettime"		},
> -[114] = { 2,	0,		SEN(clock_getres_time32),	"clock_getres"		},
> -[115] = { 4,	0,		SEN(clock_nanosleep_time32),	"clock_nanosleep"	},
>  [116] = { 3,	0,		SEN(syslog),			"syslog"		},
>  [117] = { 4,	0,		SEN(ptrace),			"ptrace"		},
>  [118] = { 2,	0,		SEN(sched_setparam),		"sched_setparam"	},
> @@ -139,7 +125,6 @@
>  [124] = { 0,	0,		SEN(sched_yield),		"sched_yield"		},
>  [125] = { 1,	0,		SEN(sched_get_priority_max),	"sched_get_priority_max"},
>  [126] = { 1,	0,		SEN(sched_get_priority_min),	"sched_get_priority_min"},
> -[127] = { 2,	0,		SEN(sched_rr_get_interval_time32),"sched_rr_get_interval"},
>  [128] = { 0,	0,		SEN(restart_syscall),		"restart_syscall"	},
>  [129] = { 2,	TS,		SEN(kill),			"kill"			},
>  [130] = { 2,	TS,		SEN(kill),			"tkill"			},
> @@ -149,7 +134,6 @@
>  [134] = { 4,	TS,		SEN(rt_sigaction),		"rt_sigaction"		},
>  [135] = { 4,	TS,		SEN(rt_sigprocmask),		"rt_sigprocmask"	},
>  [136] = { 2,	TS,		SEN(rt_sigpending),		"rt_sigpending"		},
> -[137] = { 4,	TS,		SEN(rt_sigtimedwait_time32),	"rt_sigtimedwait"	},
>  [138] = { 3,	TS,		SEN(rt_sigqueueinfo),		"rt_sigqueueinfo"	},
>  [139] = { 0,	TS,		SEN(rt_sigreturn),		"rt_sigreturn"		},
>  [140] = { 3,	0,		SEN(setpriority),		"setpriority"		},
> @@ -183,7 +167,6 @@
>  [168] = { 3,	0,		SEN(getcpu),			"getcpu"		},
>  [169] = { 2,	0,		SEN(gettimeofday),		"gettimeofday"		},
>  [170] = { 2,	0,		SEN(settimeofday),		"settimeofday"		},
> -[171] = { 1,	0,		SEN(adjtimex32),		"adjtimex"		},
>  [172] = { 0,	PU|NF,		SEN(getpid),			"getpid"		},
>  [173] = { 0,	PU|NF,		SEN(getppid),			"getppid"		},
>  [174] = { 0,	TC|PU|NF,	SEN(getuid),			"getuid"		},
> @@ -194,8 +177,6 @@
>  [179] = { 1,	0,		SEN(sysinfo),			"sysinfo"		},
>  [180] = { 4,	TD,		SEN(mq_open),			"mq_open"		},
>  [181] = { 1,	0,		SEN(mq_unlink),			"mq_unlink"		},
> -[182] = { 5,	TD,		SEN(mq_timedsend_time32),	"mq_timedsend"		},
> -[183] = { 5,	TD,		SEN(mq_timedreceive_time32),	"mq_timedreceive"	},
>  [184] = { 2,	TD,		SEN(mq_notify),			"mq_notify"		},
>  [185] = { 3,	TD,		SEN(mq_getsetattr),		"mq_getsetattr"		},
>  [186] = { 2,	TI,		SEN(msgget),			"msgget"		},
> @@ -204,7 +185,6 @@
>  [189] = { 4,	TI,		SEN(msgsnd),			"msgsnd"		},
>  [190] = { 3,	TI,		SEN(semget),			"semget"		},
>  [191] = { 4,	TI,		SEN(semctl),			"semctl"		},
> -[192] = { 4,	TI,		SEN(semtimedop_time32),		"semtimedop"		},
>  [193] = { 3,	TI,		SEN(semop),			"semop"			},
>  [194] = { 3,	TI,		SEN(shmget),			"shmget"		},
>  [195] = { 3,	TI,		SEN(shmctl),			"shmctl"		},
> @@ -255,7 +235,6 @@
>  [240] = { 4,	TP|TS,		SEN(rt_tgsigqueueinfo),		"rt_tgsigqueueinfo"	},
>  [241] = { 5,	TD,		SEN(perf_event_open),		"perf_event_open"	},
>  [242] = { 4,	TN,		SEN(accept4),			"accept4"		},
> -[243] = { 5,	TN,		SEN(recvmmsg_time32),		"recvmmsg"		},
>  /* [244 ... 259] are arch specific */
>  [260] = { 4,	TP,		SEN(wait4),			"wait4"			},
>  [261] = { 4,	0,		SEN(prlimit64),			"prlimit64"		},
> @@ -263,7 +242,6 @@
>  [263] = { 6,	TD|TF,		SEN(fanotify_mark),		"fanotify_mark"		},
>  [264] = { 5,	TD|TF,		SEN(name_to_handle_at),		"name_to_handle_at"	},
>  [265] = { 3,	TD,		SEN(open_by_handle_at),		"open_by_handle_at"	},
> -[266] = { 2,	0,		SEN(clock_adjtime32),		"clock_adjtime"		},
>  [267] = { 1,	TD,		SEN(syncfs),			"syncfs"		},
>  [268] = { 2,	TD,		SEN(setns),			"setns"			},
>  [269] = { 4,	TN,		SEN(sendmmsg),			"sendmmsg"		},
> @@ -289,10 +267,12 @@
>  [289] = { 2,	0,		SEN(pkey_alloc),		"pkey_alloc"		},
>  [290] = { 1,	0,		SEN(pkey_free),			"pkey_free"		},
>  [291] = { 5,	TD|TF|TSTA,	SEN(statx),			"statx"			},
> -[292] = { 6,	0,		SEN(io_pgetevents_time32),	"io_pgetevents"		},
>  [293] = { 4,	0,		SEN(rseq),			"rseq"			},
>  [294] = { 5,	TD,		SEN(kexec_file_load),		"kexec_file_load"	},
>  /* [295 ... 402] - reserved to sync up with other architectures */
> +#if HAVE_ARCH_TIME32_SYSCALLS
> +# include "syscallent-common-time32.h"
> +#endif

I don't think these syscallent records are common enough to be called
linux/syscallent-common-time32.h because all traditional 32-bit
architectures have different syscall numbers.  I suggest to use
a different name for this new file, e.g. linux/32/syscallent-time32.h.

Also the numbers of these old 32-bit time_t based syscalls are all below
295, so for consistency the include should probably be placed before
the comment about reserved syscall numbers.

BTW, "make distcheck" fails unless this file is added to EXTRA_DIST list
in Makefile.am file.

>  #include "syscallent-common-32.h"
>  #include "syscallent-common.h"
>  
> diff --git a/linux/syscallent-common-time32.h b/linux/syscallent-common-time32.h
> new file mode 100644
> index 00000000..44551a03
> --- /dev/null
> +++ b/linux/syscallent-common-time32.h
> @@ -0,0 +1,30 @@
> +/*
> + * Copyright (c) 2020 The strace developers.
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: LGPL-2.1-or-later
> + */
> +
> +[  4] = { 5,	0,		SEN(io_getevents_time32),	"io_getevents"		},
> +[ 72] = { 6,	TD,		SEN(pselect6_time32),		"pselect6"		},
> +[ 73] = { 5,	TD,		SEN(ppoll_time32),		"ppoll"			},
> +[ 86] = { 4,	TD,		SEN(timerfd_settime32),		"timerfd_settime"	},
> +[ 87] = { 2,	TD,		SEN(timerfd_gettime32),		"timerfd_gettime"	},
> +[ 88] = { 4,	TD|TF,		SEN(utimensat_time32),		"utimensat"		},
> +[ 98] = { 6,	0,		SEN(futex_time32),		"futex"			},
> +[101] = { 2,	0,		SEN(nanosleep_time32),		"nanosleep"		},
> +[108] = { 2,	0,		SEN(timer_gettime32),		"timer_gettime"		},
> +[110] = { 4,	0,		SEN(timer_settime32),		"timer_settime"		},
> +[112] = { 2,	0,		SEN(clock_settime32),		"clock_settime"		},
> +[113] = { 2,	0,		SEN(clock_gettime32),		"clock_gettime"		},
> +[114] = { 2,	0,		SEN(clock_getres_time32),	"clock_getres"		},
> +[115] = { 4,	0,		SEN(clock_nanosleep_time32),	"clock_nanosleep"	},
> +[127] = { 2,	0,		SEN(sched_rr_get_interval_time32),"sched_rr_get_interval"},
> +[137] = { 4,	TS,		SEN(rt_sigtimedwait_time32),	"rt_sigtimedwait"	},
> +[171] = { 1,    0,              SEN(adjtimex32),                "adjtimex"              },
> +[182] = { 5,	TD,		SEN(mq_timedsend_time32),	"mq_timedsend"		},
> +[183] = { 5,	TD,		SEN(mq_timedreceive_time32),	"mq_timedreceive"	},
> +[192] = { 4,	TI,		SEN(semtimedop_time32),		"semtimedop"		},
> +[243] = { 5,	TN,		SEN(recvmmsg_time32),		"recvmmsg"		},
> +[266] = { 2,	0,		SEN(clock_adjtime32),		"clock_adjtime"		},
> +[292] = { 6,	0,		SEN(io_pgetevents_time32),	"io_pgetevents"		},

The adjtimex32 record here uses different white spaces anf therefore looks odd.


-- 
ldv


More information about the Strace-devel mailing list