summaryrefslogtreecommitdiff
path: root/scsi.c
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright headersDmitry V. Levin2019-09-251-0/+1
| | | | | Headers updated automatically using maint/update_copyright_years.sh script.
* xlat/scsi_sg_commands: use XLAT_MACROS_ONLY instead of #stopDmitry V. Levin2019-08-141-1/+3
| | | | | | | * xlat/scsi_sg_commands.in: Remove #stop. * scsi.c: Wrap "xlat/scsi_sg_commands.h" inclusion in XLAT_MACROS_ONLY. * tests/ioctl_scsi.c: Likewise. * tests/ioctl_sg_io_v4.c: Likewise.
* Update copyright headersDmitry V. Levin2018-12-241-1/+1
|
* Change the license of strace to LGPL-2.1-or-laterDmitry V. Levin2018-12-101-21/+1
| | | | | | | | strace is now provided under the terms of the GNU Lesser General Public License version 2.1 or later, see COPYING for more details. strace test suite is now provided under the terms of the GNU General Public License version 2 or later, see tests/COPYING for more details.
* Imply RVAL_DECODED when RVAL_IOCTL_PARSED is returned on enteringDmitry V. Levin2017-08-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, rename RVAL_IOCTL_PARSED to RVAL_IOCTL_DECODED as the latter is a more suitable name. * defs.h (RVAL_IOCTL_PARSED): Rename to RVAL_IOCTL_DECODED. * ioctl.c (ioctl_decode): Update comment. (SYS_FUNC(ioctl)): Replace RVAL_IOCTL_PARSED with RVAL_IOCTL_DECODED, add convertation of RVAL_IOCTL_DECODED to RVAL_DECODED. * block.c (block_ioctl): Replace RVAL_DECODED | RVAL_IOCTL_PARSED with RVAL_IOCTL_DECODED on entering. Replace RVAL_IOCTL_PARSED with RVAL_IOCTL_DECODED on exiting. * btrfs.c (btrfs_ioctl): Likewise. * evdev.c: Likewise. * file_ioctl.c: Likewise. * fs_x_ioctl.c: Likewise. * hdio.c: Likewise. * loop.c: Likewise. * mtd.c: Likewise. * nsfs.c: Likewise. * print_sg_req_info.c: Likewise. * ptp.c: Likewise. * rtc.c: Likewise. * scsi.c: Likewise. * sg_io_v3.c: Likewise. * sg_io_v4.c: Likewise. * sock.c: Likewise. * term.c: Likewise. * ubi.c: Likewise. * userfaultfd.c: Likewise. * dm.c (dm_known_ioctl): Return RVAL_IOCTL_DECODED on exiting and 0 on entering. Replace RVAL_IOCTL_PARSED with RVAL_IOCTL_DECODED on exiting. * v4l2.c: Likewise. Co-authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
* Replace return 1 ioctl sub-decoder hack with proper flagEugene Syromyatnikov2017-08-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * defs.h (RVAL_IOCTL_PARSED): Introduce new flag for ioctl sub-decoders * to signalise that they have successfully printed argument. * ioctl.c (SYS_FUNC(ioctl)): Check for RVAL_IOCTL_PARSED flag, remove un-set it before returning the value. * block.c: Use RVAL_IOCTL_PARSED instead of 1. * btrfs.c: Likewise. * dm.c: Likewise. * evdev.c: Likewise. * file_ioctl.c: Likewise. * fs_x_ioctl.c: Likewise. * hdio.c: Likewise. * loop.c: Likewise. * mtd.c: Likewise. * nsfs.c: Likewise. * print_sg_req_info.c: Likewise. * ptp.c: Likewise. * rtc.c: Likewise. * scsi.c: Likewise. * sg_io_v3.c: Likewise. * sg_io_v4.c: Likewise. * sock.c: Likewise. * term.c: Likewise. * ubi.c: Likewise. * userfaultfd.c: Likewise. * v4l2.c: Likewise.
* Do not return RVAL_DECODED on exiting path of ioctl decodersEugene Syromyatnikov2017-08-281-1/+1
| | | | | | | | * print_sg_req_info.c (decode_sg_req_info): Return 1 instead of RVAL_DECODED | 1 on exiting path. * scsi.c (decode_sg_scsi_id): Likewise. * sg_io_v3.c (decode_response): Likewise. * sg_io_v4.c (decode_response): Likewise.
* scsi: implement decoding of all SG_* ioctl commandsDmitry V. Levin2017-01-101-0/+103
| | | | | | | | * print_sg_req_info.c: New file. * Makefile.am (strace_SOURCES): Add it. * xlat/sg_scsi_reset.in: New file. * scsi.c: Include "xlat/sg_scsi_reset.h". (scsi_ioctl): Implement decoding of all SG_* ioctl commands.
* scsi: prepare for decoding of other SG_* ioctl commandsDmitry V. Levin2017-01-101-15/+19
| | | | * scsi.c (scsi_ioctl): Introduce a switch statement.
* scsi: add fallback definitions for SG_* ioctl command constantsDmitry V. Levin2017-01-101-3/+1
| | | | | | | | | Unfortunately, <scsi/sg.h> from libc does not provide all constants recognized by the kernel. * xlat/scsi_sg_commands.in: New file. * scsi.c: Include "xlat/scsi_sg_commands.h" instead of providing a fallback definition of SG_IO.
* sg_io: decode structures on exiting syscall in case of syserrorDmitry V. Levin2017-01-101-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | The SCSI driver, starting with kernel commit v2.6.25-rc1~1230^2~78, translates its "struct request.errors" to ioctl errors after filling in all the output members of the SG_IO header structure. As there is no easy way to tell SCSI layer errors from other syscall errors, decode the structure on exiting syscall in case of syserror, too. * scsi.c (scsi_ioctl): Do not call set_tcb_priv_ulong, use get_tcb_priv_data instead of get_tcb_priv_ulong, call decode_sg_io unconditionally. * sg_io_v3.c (decode_request): Save a copy of struct_sg_io_hdr using set_tcb_priv_data. (decode_response): Restore it using get_tcb_priv_data. Print its i/o fields when umove call fails. Pass IOV_DECODE_STR to tprint_iov_upto unconditionally. * sg_io_v4.c (decode_request): Save a copy of struct sg_io_v4 using set_tcb_priv_data. (decode_response): Restore it using get_tcb_priv_data. Print its i/o fields when umove call fails. Pass IOV_DECODE_STR to tprint_iov_upto unconditionally.
* Split scsi.cDmitry V. Levin2017-01-081-227/+14
| | | | | | | | | | | | | | | | | | | Move decoders of SG_IO v3 and v4 APIs into separate files, compile generic SG_IO decoder unconditionally. * sg_io_v3.c: New file. * sg_io_v4.c: Likewise. * Makefile.am (strace_SOURCES): Add them. * defs.h (decode_sg_io_v3, decode_sg_io_v4): New prototypes. * ioctl.c (ioctl_decode): Remove [HAVE_SCSI_SG_H] condition. * scsi.c: (print_sg_io_res): Remove. (print_sg_io_req): Rename to decode_sg_io, replace print_sg_io_v3_req with decode_sg_io_v3, replace print_sg_io_v4_req with decode_sg_io_v4, compile uncoditionally. (scsi_ioctl): Replace print_sg_io_req and print_sg_io_res with decode_sg_io, compile uncoditionally. Move [HAVE_SCSI_SG_H] code to sg_io_v3.c. Move [HAVE_LINUX_BSG_H] code to sg_io_v4.c.
* scsi: detect and print changes of interface idDmitry V. Levin2017-01-071-0/+10
| | | | | | | | * scsi.c (print_sg_io_v3_res): Detect and print changes of struct sg_io_hdr.interface_id field between entering and exiting syscall. (print_sg_io_v4_res): Detect and print changes of struct sg_io_v4.guard field between entering and exiting syscall.
* scsi: print field names of all fields being printedDmitry V. Levin2017-01-071-13/+18
| | | | | | | | | | * scsi.c (print_sg_io_v3_req): Always print the name of struct sg_io_hdr.interface_id field. (print_sg_io_v4_req): Always print the name of struct sg_io_v4.guard field. (print_sg_io_req): Print unknown interface id as an integer. (scsi_ioctl): Save interface id on entering syscall and use it on exiting syscall.
* scsi: print struct sg_io_hdr.dxfer_direction field nameDmitry V. Levin2017-01-071-0/+1
| | | | | * scsi.c (print_sg_io_v3_req): Print struct sg_io_hdr.dxfer_direction field name.
* scsi: print "protocol" and "subprotocol" field names of struct sg_io_v4Dmitry V. Levin2017-01-071-1/+2
| | | | | * scsi.c (print_sg_io_v4_req): Print field names of struct sg_io_v4.protocol and struct sg_io_v4.subprotocol.
* scsi: rewrite print_sg_io_buffer using printstr_ex(QUOTE_FORCE_HEX)Dmitry V. Levin2017-01-061-12/+1
| | | | | | | | As printstr_ex has got QUOTE_FORCE_HEX flag support, there is no need to implement it manually any longer. * scsi.c (print_uchar): Remove. (print_sg_io_buffer): Rewrite using printstr_ex(QUOTE_FORCE_HEX).
* Automatically replace kernel_(scno|ureg)_t with kernel_ulong_tDmitry V. Levin2016-12-261-10/+10
| | | | | | | | | | | | | Remove temporary types created for transition from long to kernel_ulong_t. Automatically replace kernel_scno_t and kernel_ureg_t with kernel_ulong_t using $ git grep -El 'kernel_(scno|ureg)_t' | xargs sed -ri 's/kernel_(scno|ureg)_t/kernel_ulong_t/g' * kernel_types.h (kernel_scno_t, kernel_ureg_t): Remove. All users updated.
* Use ptr_to_kulong instead of explicit casts of pointers to kernel_ureg_tDmitry V. Levin2016-12-261-6/+6
| | | | | | | | | | | | | | | | | | | | | | Direct casts to kernel_ureg_t will not work after the change of kernel_ureg_t from unsigned long to kernel_ulong_t. * defs.h (ptr_to_kulong): New macro. * block.c (print_blkpg_req): Use it instead of explicit casts to kernel_ureg_t. * btrfs.c (btrfs_ioctl): Likewise. * evdev.c (ff_effect_ioctl): Likewise. * mmsghdr.c (dumpiov_in_mmsghdr): Likewise. * msghdr.c (print_struct_msghdr, dumpiov_in_msghdr): Likewise. * mtd.c (decode_mtd_oob_buf): Likewise. * printsiginfo.c (printsigval, print_si_info): Likewise. * scsi.c (print_sg_io_v3_req, print_sg_io_v3_res): Likewise. * sigaltstack.c (print_stack_t): Likewise. * sock.c (decode_ifconf): Likewise. * sysctl.c (SYS_FUNC(sysctl)): Likewise. * util.c (dumpiov_upto): Likewise. * v4l2.c (print_v4l2_framebuffer, print_v4l2_ext_control, print_v4l2_ext_controls): Likewise.
* Change type of ioctl 3rd argument from long to kernel_ureg_tDmitry V. Levin2016-12-251-9/+12
| | | | | | | | | | | | | | | | | | | | | * defs.h (DECL_IOCTL): Change arg type from long to kernel_ureg_t. * dm.c (dm_known_ioctl, dm_ioctl): Likewise. * file_ioctl.c (file_ioctl): Likewise. * fs_x_ioctl.c (fs_x_ioctl): Likewise. * ioctl.c (ioctl_decode): Likewise. * loop.c (decode_loop_info, decode_loop_info64): Change addr type from long to kernel_ureg_t. (loop_ioctl): Change arg type from long to kernel_ureg_t. * ptp.c (ptp_ioctl): Likewise. * scsi.c (print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req, print_sg_io_v4_res, scsi_ioctl): Likewise. * sock.c (print_ifreq, sock_ioctl): Likewise. (decode_ifconf): Change addr type from long to kernel_ureg_t. * term.c (decode_termios, decode_termio, decode_winsize, decode_ttysize, decode_modem_flags): Likewise. (term_ioctl): Change arg type from long to kernel_ureg_t. * ubi.c (ubi_ioctl): Likewise. * userfaultfd.c (uffdio_ioctl): Likewise.
* scsi: change address argument type from unsigned long to kernel_ureg_tDmitry V. Levin2016-12-231-1/+2
| | | | | * scsi.c (print_sg_io_buffer): Change address argument type from unsigned long to kernel_ureg_t.
* scsi: cast pointers to kernel_ureg_t instead of unsigned longDmitry V. Levin2016-12-211-6/+6
| | | | | | * scsi.c (print_sg_io_v3_req, print_sg_io_v3_res): Cast sg_io_hdr.cmdp, sg_io_hdr.dxferp, and sg_io_hdr.sbp pointers to kernel_ureg_t instead of unsigned long.
* scsi: use umove_or_printaddrDmitry V. Levin2016-12-211-2/+1
| | | | * scsi.c (scsi_ioctl): Use umove_or_printaddr.
* io: use umoven_or_printaddr_ignore_syserror as umove function in tprint_iov_uptoEugene Syromyatnikov2016-10-281-2/+3
| | | | | | | | | | | | | | | | | | | | | | | This enables printing of iovec arrays even in case of failed syscall (failed syscall doesn't mean that iovec itself is inaccessible and useless). One caveat here is that we should explicitly provide proper IOV_DECODE_* value based on syserror value in case printing is performed on exiting; we can't simply override it to IOV_DECODE_ADDR on exiting when syserror is up, since this may be called by code which tries to print iovec containing local data, which should be perfectly accessible (on the other hand, there are no cases of such behaviour at the moment). Since iovecs themselves are printed even if syscall has failed now, preadv test is updated to reflect this. It is notable, though, that this is the only place where this case is checked. * io.c (tprint_iov_upto): Specify umoven_or_printaddr_ignore_syserror instead of umoven_or_printaddr as umoven_func parameter. (SYS_FUNC(readv), do_preadv): Specify decode_iov parameter value based on syserror(tcp) value. * scsi.c: (print_sg_io_v3_res, print_sg_io_v4_res): Likewise. * tests/preadv.c: Update expected output for the case when preadv with singe-item iovec failed.
* Use tprints instead of tprintf in a few more placesDmitry V. Levin2016-10-021-1/+1
| | | | | | | | | | * btrfs.c (btrfs_print_qgroup_inherit, btrfs_print_tree_search, btrfs_ioctl): Replace tprintf with tprints for printing strings without format specifiers. * net.c (print_group_req): Likewise. * scsi.c (scsi_ioctl): Likewise. * term.c (decode_termios, decode_termio): Likewise. * userfaultfd.c (uffdio_ioctl): Likewise.
* Add a enum for decoding to tprint_iov() and tprint_iov_upto()Fabien Siron2016-06-221-4/+6
| | | | | | | | | | | | | | | | | | | | | Introduce a new type iov_decode which will be used instead of the integer "decode" as a parameter. * defs.h (iov_decode): New enum. (tprint_iov, tprint_iov_upto): Change type of "decode_iov" to enum iov_decode. * aio.c (print_iocb): Change type of "decode_iov" to enum iov_decode in tprint_iov() call. * keyctl.c (keyctl_instantiate_key_iov): Likewise. * process.c (ptrace): Likewise. * process_vm.c (process_vm_readv, process_vm_writev): Likewise. * io.c (writev, do_pwritev, vmsplice): Likewise. (print_iovec): Replace the condition with a switch. (tprint_iov_upto): Change type of "decode_iov" to enum iov_decode. (readv, do_preadv): Change type of "decode_iov" to enum iov_decode in tprint_iov_upto() call. * scsi.c (print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req, print_sg_io_v4_res): Likewise. * net.c (do_msghdr): Adapt call of tprint_iov_upto().
* scsi.c: print __u64 types using PRI__u64 formatDmitry V. Levin2016-05-261-3/+3
| | | | | * scsi.c (print_sg_io_v4_req, print_sg_io_v4_res): Remove explicit casts to unsigned long long, print fields of type __u64 using PRI__u64 format.
* scsi.c: use print_array functionDmitry V. Levin2016-05-071-21/+13
| | | | | * scsi.c (print_uchar): New function. (print_sg_io_buffer): Use it via print_array.
* scsi.c: use printaddrDmitry V. Levin2015-07-181-3/+3
| | | | * scsi.c (print_sg_io_buffer): Use printaddr.
* scsi.c: enhance SG_IO ioctl parserDmitry V. Levin2015-07-101-54/+52
| | | | | | | | | | Fix SG_IO ioctl output in case of failed umove * scsi.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>. Update for RVAL_DECODED. (print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req, print_sg_io_v4_res): Do not print address in case of failed umove. (scsi_ioctl): Use printaddr.
* Change last parameter of umoven() from char* to void*Denys Vlasenko2015-03-211-1/+1
| | | | | | Saves tons of casts. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* Fix compilation warnings about incompatible print formatsDmitry V. Levin2015-02-231-3/+3
| | | | | | | | | | | On some platforms printing of __s64 types with "%lld" format, or __u64 types with "%llu" or "%llx" formats causes a warning that __s64/__u64 type is not compatible with long long format. From my PoV, this is nonsense, but the workaround costs nothing. * scsi.c (print_sg_io_v4_req, print_sg_io_v4_res): Cast __u64 types to (unsigned long long). * v4l2.c (v4l2_ioctl): Likewise. Cast __s64 type to (long long).
* scsi: add bsg supportBart Van Assche2015-02-081-55/+195
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Linux kernel supports two different versions of the SG_IO API, namely v3 and v4. This patch adds support for version 4 of this API. At least the sg3_utils package supports version 4 of this API. Version 4 of this API is used if /dev/bsg/H:C:I:L is used as device name. This patch has been tested by inspecting the output of the following commands: modprobe scsi_debug dev_size_mb=16 delay=0 dev=$(lsscsi | sed -n '/ scsi_debug /s,^[^/]*,,p') ./strace -eioctl -s256 sg_inq $dev echo 'Test XDWRITEREAD(10)' bsg=/dev/bsg/$(lsscsi | sed -n '/ scsi_debug /s,^\[\([^]]\+\)\].*,\1,p') dd if=/dev/zero bs=512 count=1 | ./strace -eioctl -s256 sg_raw -s 512 -r 1024 $bsg 53 00 00 00 00 01 00 00 01 00 * configure.ac (AC_CHECK_HEADERS): Add linux/bsg.h. * xlat/bsg_protocol.in: New file. * xlat/bsg_subprotocol.in: Likewise. * scsi.c: Include them and <linux/bsg.h>. (print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req, print_sg_io_v4_res): New functions. (print_sg_io_req, print_sg_io_res): Use them. (scsi_ioctl): Update callers. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* scsi: Add iovec supportBart Van Assche2015-02-081-8/+16
| | | | | | | | | * scsi.c (print_sg_io_req, print_sg_io_res): Add support for decoding iovecs passed via the SG I/O v3 interface. Decode the "data in" and "data out" buffers in hex instead of in ASCII. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* scsi: on exit, print only initialized part of the bufferBart Van Assche2015-02-081-3/+7
| | | | | | | | * scsi.c (print_sg_io_res): Only print that part of the data in buffer that has been initialized by the SCSI LLD driver. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* scsi: make print_sg_io_buffer() print square brackets instead of its callersBart Van Assche2015-02-081-8/+10
| | | | | | | | * scsi.c (print_sg_io_buffer): Print square brackets in this function. (print_sg_io_req, print_sg_io_res): Update callers. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* scsi: improve consistency with other decoding functionsBart Van Assche2015-02-081-5/+5
| | | | | | | | | | | Pass pointers to tracee's memory as integers instead of pointers. * scsi.c (print_sg_io_buffer): Change second argument's type to unsigned long. (print_sg_io_req, print_sg_io_res): Update callers. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* ioctl: assume that all ioctl commands have unsigned int typeDmitry V. Levin2015-01-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | In linux, ioctl command number has a 32-bit unsigned integer type: fs/ioctl.c:SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg) If the kernel completely ignores other bits on 64-bit architectures, why should strace care? Let's follow the kernel and treat it as unsigned int. * defs.h (struct_ioctlent): Change "code" type to "unsigned int". (ioctl_decode, ioctl_lookup, block_ioctl, loop_ioctl, mtd_ioctl, ubi_ioctl, ptp_ioctl, scsi_ioctl, sock_ioctl, term_ioctl, rtc_ioctl, v4l2_ioctl): Likewise. * ioctl.c (ioctl_decode, ioctl_lookup, compare, ioctl_next_match): Likewise. * block.c (block_ioctl): Likewise. * loop.c (loop_ioctl): Likewise. * mtd.c (mtd_ioctl, ubi_ioctl): Likewise. * ptp.c (ptp_ioctl): Likewise. * scsi.c (scsi_ioctl): Likewise. * sock.c (sock_ioctl): Likewise. * term.c (term_ioctl): Likewise. * time.c (rtc_ioctl): Likewise. * v4l2.c (v4l2_ioctl): Likewise. * ioctlsort.c (struct ioctlent, compare, main): Likewise.
* Fix compilation warnings reported by gcc -Wsign-compareDmitry V. Levin2014-09-171-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (gl_WARN_ADD): Add -Wsign-compare. * defs.h (struct tcb): Change 'currpers' type to unsigned. (struct xlat): Change 'val' type to unsigned (signame): Add 'const' qualifier to its argument. (xlookup, printxval): Add 'const' qualifier to the 2nd argument and change its type to unsigned. (printpathn): Change the 3rd argument type to unsigned. (ioctl_lookup): Change 1st argument type to unsigned. * count.c (call_summary_pers, call_summary): Change 'i' type to unsigned. * file.c (print_xattr_list): Fix comparisons between signed and unsigned long values. * ioctl.c (compare): Fix cast. (ioctl_lookup): Change 1st argument type to to unsigned. (ioctl_next_match): Change 'code' type to unsigned. * mem.c (sys_move_pages): Change 'i' type to unsigned. * mtd.c (mtd_ioctl): Change 'i' and 'j' types to unsigned. Print 'i' using %u format string. * process.c (sys_prctl): Change 'i' type to unsigned. (printargv): Change 'n' type to unsigned. (sys_ptrace): Change 'addr' type to unsigned. * scsi.c (print_sg_io_buffer): Add 'const' qualifier to 'len' argument and change its type to unsigned. Change 'i' and 'allocated' types to unsigned. * signal.c (signame): Add 'const' qualifier to its argument. Fix comparisons between signed and unsigned values. (sprintsigmask_n, printsiginfo): Fix comparisons between signed and unsigned values. * sock.c (sock_ioctl): Change 'i' and 'nifra' types to unsigned. * strace.c (expand_tcbtab, alloctcb): Change 'i' type to unsigned. (detach): Change 'sig' type to unsigned. (startup_attach): Change 'tcbi' type to unsigned. (startup_child): Change 'm', 'n', and 'len' types to unsigned. (init): Use new variable to iterate 'tcbtab'. (pid2tcb): Change 'i' type to unsigned. (cleanup): Change 'i' and 'sig' types to unsigned. * syscall.c (update_personality): Change 'personality' argument type to unsigned. (struct qual_options): Change 'bitflag' type to unsigned. (reallocate_qual): Add 'const' qualifier to its argument and change its type to unsigned. (qualify_one): Change 'n' and 'bitflag' arguments types to unsigned. Add 'const' qualifier to 'n', 'not', and 'pers' arguments. Change 'p' type to signed int. (qual_syscall): Change 'bitflag' argument type to unsigned. Add 'const' qualifier to 'bitflag' and 'not' arguments. Change 'p' type to signed int. (qual_signal): Change 'bitflag' argument type to unsigned. Add 'const' qualifier to 'bitflag' and 'not' arguments. Change 'i' type to unsigned. (qual_desc): Change 'bitflag' argument type to unsigned. Add 'const' qualifier to 'bitflag' and 'not' arguments. (qualify): Change 'i' type to unsigned. (get_scno): Change 'currpers' type to unsigned. Fix a comparison between signed and unsigned values. * system.c (sys_sysctl): Change 'cnt' and 'max_cnt' types to unsigned. Fix comparisons between signed and unsigned values. * util.c (xlookup, printxval): Add 'const' qualifier to 'val' argument and change its type to unsigned. (printuid): Fix a comparison between signed and unsigned values. (printpathn): Change 'n' argument type to unsigned. (printstr): Change 'size' type to unsigned. Fix a comparison between signed and unsigned values. (setbpt): Change 'i' type to unsigned. * net.c (printsock): Silence a compilation warning. * reboot.c (sys_reboot): Likewise.
* Generate xlat/*.in filesDmitry V. Levin2014-05-301-7/+1
| | | | | Automatically convert xlat structures from *.c files to xlat/*.in files using "./generate_xlat_in.sh *.c" command.
* Do not compile scsi ioctl decoding if <scsi/sg.h> is not availableDmitry V. Levin2014-02-251-2/+7
| | | | | | | | | | | Add a generic test for <scsi/sg.h> availability to fix build with Bionic libc that does not provide <scsi/sg.h>. * configure.ac (AC_CHECK_HEADERS): Add scsi/sg.h. * ioctl.c (ioctl_decode): Do not call scsi_ioctl if !HAVE_SCSI_SG_H. * scsi.c: Do not compile scsi ioctl decoding if !HAVE_SCSI_SG_H. Reported-by: Elliott Hughes <enh@google.com>
* Use XLAT_END macroDmitry V. Levin2014-02-051-1/+1
| | | | | Automatically update all xlat structures using the following sed regexp: s/^[[:space:]]*{[[:space:]]*0[[:space:]]*,[[:space:]]*NULL[[:space:]]*,\?[[:space:]]*}[[:space:]]*,\?[[:space:]]*/\tXLAT_END/
* Use XLAT macroDmitry V. Levin2014-02-051-4/+4
| | | | | | Automatically convert all xlat structures to XLAT form using the following sed regexp: s/^[[:space:]]*{[[:space:]]*\([^",}[:space:]]\+\)[[:space:]]*,[[:space:]]*"\1",\?[[:space:]]*}[[:space:]]*/\tXLAT(\1)/
* Tidy up includes and copyright notices, fix indentationDenys Vlasenko2012-03-161-1/+0
| | | | | | | | | | | | | | | The files not mentioned in changelog below had only copyright notices fixes and indentation fixes. * defs.h: Include <stdint.h> and <inttypes.h>. * file.c: Do not include <inttypes.h>. Move struct kernel_dirent declaration below top include block. * block.c: Do not include <stdint.h> and <inttypes.h>. * quota.c: Likewise. * desc.c: Likewise. * signal.c: Likewise. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* scsi.c: add copyright headerDmitry V. Levin2012-03-161-0/+28
| | | | | * scsi.c: This file was added back in 2007 without a copyright header. Add it now.
* Automated removal of non-Linux codeDenys Vlasenko2012-02-251-2/+0
| | | | | | | | | | This change is generated by running every source through the following command: unifdef -DLINUX -Dlinux -USUNOS4 -USVR4 -UUNIXWARE -UFREEBSD -USUNOS4_KERNEL_ARCH_KLUDGE -UHAVE_MP_PROCFS -UHAVE_POLLABLE_PROCFS -UHAVE_PR_SYSCALL -UUSE_PROCFS file.c Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Use tprints with literal strings, it may be faster than tprintfDenys Vlasenko2011-09-011-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | * bjm.c: Replace tprintf("str") with tprints("str"). * block.c: Likewise. * desc.c: Likewise. * file.c: Likewise. * io.c: Likewise. * ipc.c: Likewise. * mem.c: Likewise. * net.c: Likewise. * proc.c: Likewise. * process.c: Likewise. * quota.c: Likewise. * resource.c: Likewise. * scsi.c: Likewise. * signal.c: Likewise. * sock.c: Likewise. * strace.c: Likewise. * stream.c: Likewise. * syscall.c: Likewise. * system.c: Likewise. * term.c: Likewise. * time.c: Likewise. * util.c: Likewise. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* 2007-03-29 Vladimir Nadvornik <nadvornik@suse.cz>Dmitry V. Levin2007-06-301-0/+114
Dmitry V. Levin <ldv@altlinux.org> Trace linux SG_IO ioctl arguments and results. * scsi.c: New file. * Makefile.am (strace_SOURCES): Add scsi.c * defs.h (scsi_ioctl): New function. * ioctl.c (ioctl_decode): Use scsi_ioctl().