1999-02-19 03:21:36 +03:00
/*
* Copyright ( c ) 1993 , 1994 , 1995 , 1996 Rick Sladkey < jrs @ world . std . com >
1999-12-23 17:20:14 +03:00
* Copyright ( c ) 1996 - 1999 Wichert Akkerman < wichert @ cistron . nl >
1999-02-19 03:21:36 +03:00
* All rights reserved .
*
* Redistribution and use in source and binary forms , with or without
* modification , are permitted provided that the following conditions
* are met :
* 1. Redistributions of source code must retain the above copyright
* notice , this list of conditions and the following disclaimer .
* 2. Redistributions in binary form must reproduce the above copyright
* notice , this list of conditions and the following disclaimer in the
* documentation and / or other materials provided with the distribution .
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission .
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ` ` AS IS ' ' AND ANY EXPRESS OR
* IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED .
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT , INDIRECT ,
* INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT
* NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE ,
* DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT
* ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .
*/
# include "defs.h"
2001-04-10 14:32:26 +04:00
2013-03-05 19:50:12 +04:00
/* Who has STREAMS syscalls?
* Linux hasn ' t . Solaris has ( had ? ) .
* Just in case I miss something , retain in for Sparc . . .
*/
2015-07-21 00:37:24 +03:00
# if (defined SPARC || defined SPARC64) \
& & ( defined SYS_putpmsg | | defined SYS_getpmsg )
2013-03-05 19:50:12 +04:00
# ifdef HAVE_STROPTS_H
# include <stropts.h>
# else
1999-02-19 03:21:36 +03:00
struct strbuf {
2008-12-30 21:47:55 +03:00
int maxlen ; /* no. of bytes in buffer */
int len ; /* no. of bytes returned */
2010-09-07 02:08:24 +04:00
const char * buf ; /* pointer to data */
1999-02-19 03:21:36 +03:00
} ;
2013-03-05 19:50:12 +04:00
# define MORECTL 1
# define MOREDATA 2
# endif
1999-02-19 03:21:36 +03:00
static void
2011-05-30 16:00:14 +04:00
printstrbuf ( struct tcb * tcp , struct strbuf * sbp , int getting )
1999-02-19 03:21:36 +03:00
{
if ( sbp - > maxlen = = - 1 & & getting )
2011-09-01 12:00:28 +04:00
tprints ( " {maxlen=-1} " ) ;
1999-02-19 03:21:36 +03:00
else {
2011-09-01 12:00:28 +04:00
tprints ( " { " ) ;
1999-02-19 03:21:36 +03:00
if ( getting )
tprintf ( " maxlen=%d, " , sbp - > maxlen ) ;
tprintf ( " len=%d, buf= " , sbp - > len ) ;
1999-05-09 04:29:58 +04:00
printstr ( tcp , ( unsigned long ) sbp - > buf , sbp - > len ) ;
2011-09-01 12:00:28 +04:00
tprints ( " } " ) ;
1999-02-19 03:21:36 +03:00
}
}
static void
2013-03-05 19:17:46 +04:00
printstrbufarg ( struct tcb * tcp , long arg , int getting )
1999-02-19 03:21:36 +03:00
{
struct strbuf buf ;
if ( arg = = 0 )
2011-09-01 12:00:28 +04:00
tprints ( " NULL " ) ;
1999-02-19 03:21:36 +03:00
else if ( umove ( tcp , arg , & buf ) < 0 )
2011-09-01 12:00:28 +04:00
tprints ( " {...} " ) ;
1999-02-19 03:21:36 +03:00
else
printstrbuf ( tcp , & buf , getting ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
1999-02-19 03:21:36 +03:00
}
2015-07-21 00:37:24 +03:00
# include "xlat / pmsgflags.h"
# ifdef SYS_putpmsg
2015-04-07 04:36:50 +03:00
SYS_FUNC ( putpmsg )
1999-02-19 03:21:36 +03:00
{
int i ;
if ( entering ( tcp ) ) {
/* fd */
tprintf ( " %ld, " , tcp - > u_arg [ 0 ] ) ;
/* control and data */
for ( i = 1 ; i < 3 ; i + + )
printstrbufarg ( tcp , tcp - > u_arg [ i ] , 0 ) ;
/* band */
tprintf ( " %ld, " , tcp - > u_arg [ 3 ] ) ;
/* flags */
2005-05-31 Dmitry V. Levin <ldv@altlinux.org>
* util.c (printxval): Change third argument from "char *" to
"const char *".
(printflags): Add third argument, "const char *", with similar
meaning to the third argument of printxval().
* defs.h (printxval): Change third argument from "char *" to
"const char *".
(printflags): Add third argument.
* bjm.c (sys_query_module) [LINUX]: Pass third argument to
printflags().
* desc.c (sys_fcntl): Likewise.
(sys_flock) [LOCK_SH]: Likewise.
(print_epoll_event) [HAVE_SYS_EPOLL_H]: Likewise.
* file.c (sys_open): Likewise.
(solaris_open) [LINUXSPARC]: Likewise.
(sys_access): Likewise.
(sys_chflags, sys_fchflags) [FREEBSD]: Likewise.
(realprintstat) [HAVE_LONG_LONG_OFF_T &&
HAVE_STRUCT_STAT_ST_FLAGS]: Likewise.
(printstat64) [HAVE_STAT64 &&
HAVE_STRUCT_STAT_ST_FLAGS]: Likewise.
(sys_setxattr, sys_fsetxattr): Likewise.
* ipc.c (sys_msgget, sys_msgsnd, sys_msgrcv, sys_semget,
sys_shmget, sys_shmat) [LINUX || SUNOS4 || FREEBSD]: Likewise.
(sys_mq_open) [LINUX]: Likewise.
(printmqattr) [HAVE_MQUEUE_H]: Likewise.
* mem.c (print_mmap) [!HAVE_LONG_LONG_OFF_T]: Likewise.
(sys_mmap64) [_LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T]: Likewise.
(sys_mprotect): Likewise.
(sys_mremap, sys_madvise, sys_mlockall) [LINUX]: Likewise.
(sys_msync) [MS_ASYNC]: Likewise.
(sys_mctl) [MC_SYNC]: Likewise.
(sys_remap_file_pages, sys_mbind, sys_get_mempolicy) [LINUX]:
Likewise.
* net.c (printmsghdr) [HAVE_STRUCT_MSGHDR_MSG_CONTROL]: Likewise.
(sys_send, sys_sendto): Likewise.
(sys_sendmsg) [HAVE_SENDMSG]: Likewise.
(sys_recv, sys_recvfrom): Likewise.
(sys_recvmsg) [HAVE_SENDMSG]: Likewise.
(printicmpfilter) [ICMP_FILTER]: Likewise.
* proc.c (proc_ioctl) [SVR4 && !HAVE_MP_PROCFS || FREEBSD]: Likewise.
* process.c (sys_clone) [LINUX]: Likewise.
(printwaitn): Likewise.
(sys_waitid) [SVR4 || LINUX]: Likewise.
* signal.c (sys_sigvec) [SUNOS4 || FREEBSD]: Likewise.
(sys_sigaction): Likewise.
(printcontext) [SVR4]: Likewise.
(print_stack_t) [LINUX) || FREEBSD]: Likewise.
(sys_rt_sigaction) [LINUX]: Likewise.
* sock.c (sock_ioctl) [LINUX]: Likewise.
* stream.c (sys_putmsg, sys_getmsg): Likewise.
(sys_putpmsg) [SYS_putpmsg]: Likewise.
(sys_getpmsg) [SYS_getpmsg]: Likewise.
(sys_poll): Likewise.
(print_transport_message) [TI_BIND]: Likewise.
(stream_ioctl): Likewise.
* system.c (sys_mount, sys_reboot): Likewise.
(sys_cacheflush) [LINUX && M68K]: Likewise.
(sys_capget, sys_capset) [SYS_capget]: Likewise.
* term.c (term_ioctl) [TIOCMGET]: Likewise.
* time.c (sys_clock_nanosleep, sys_timer_settime) [LINUX]:
Likewise.
Fixes RH#159310.
2005-06-01 23:02:36 +04:00
printflags ( pmsgflags , tcp - > u_arg [ 4 ] , " MSG_??? " ) ;
1999-02-19 03:21:36 +03:00
}
return 0 ;
}
2015-07-21 00:37:24 +03:00
# endif
# ifdef SYS_getpmsg
2015-04-07 04:36:50 +03:00
SYS_FUNC ( getpmsg )
1999-02-19 03:21:36 +03:00
{
int i , flags ;
if ( entering ( tcp ) ) {
/* fd */
tprintf ( " %lu, " , tcp - > u_arg [ 0 ] ) ;
} else {
if ( syserror ( tcp ) ) {
tprintf ( " %#lx, %#lx, %#lx, %#lx " , tcp - > u_arg [ 1 ] ,
tcp - > u_arg [ 2 ] , tcp - > u_arg [ 3 ] , tcp - > u_arg [ 4 ] ) ;
return 0 ;
}
/* control and data */
for ( i = 1 ; i < 3 ; i + + )
printstrbufarg ( tcp , tcp - > u_arg [ i ] , 1 ) ;
/* pointer to band */
2015-02-18 01:00:45 +03:00
printnum_int ( tcp , tcp - > u_arg [ 3 ] , " %d " ) ;
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
1999-02-19 03:21:36 +03:00
/* pointer to flags */
if ( tcp - > u_arg [ 4 ] = = 0 )
2011-09-01 12:00:28 +04:00
tprints ( " NULL " ) ;
1999-02-19 03:21:36 +03:00
else if ( umove ( tcp , tcp - > u_arg [ 4 ] , & flags ) < 0 )
2011-09-01 12:00:28 +04:00
tprints ( " [?] " ) ;
1999-02-19 03:21:36 +03:00
else {
2011-09-01 12:00:28 +04:00
tprints ( " [ " ) ;
2005-05-31 Dmitry V. Levin <ldv@altlinux.org>
* util.c (printxval): Change third argument from "char *" to
"const char *".
(printflags): Add third argument, "const char *", with similar
meaning to the third argument of printxval().
* defs.h (printxval): Change third argument from "char *" to
"const char *".
(printflags): Add third argument.
* bjm.c (sys_query_module) [LINUX]: Pass third argument to
printflags().
* desc.c (sys_fcntl): Likewise.
(sys_flock) [LOCK_SH]: Likewise.
(print_epoll_event) [HAVE_SYS_EPOLL_H]: Likewise.
* file.c (sys_open): Likewise.
(solaris_open) [LINUXSPARC]: Likewise.
(sys_access): Likewise.
(sys_chflags, sys_fchflags) [FREEBSD]: Likewise.
(realprintstat) [HAVE_LONG_LONG_OFF_T &&
HAVE_STRUCT_STAT_ST_FLAGS]: Likewise.
(printstat64) [HAVE_STAT64 &&
HAVE_STRUCT_STAT_ST_FLAGS]: Likewise.
(sys_setxattr, sys_fsetxattr): Likewise.
* ipc.c (sys_msgget, sys_msgsnd, sys_msgrcv, sys_semget,
sys_shmget, sys_shmat) [LINUX || SUNOS4 || FREEBSD]: Likewise.
(sys_mq_open) [LINUX]: Likewise.
(printmqattr) [HAVE_MQUEUE_H]: Likewise.
* mem.c (print_mmap) [!HAVE_LONG_LONG_OFF_T]: Likewise.
(sys_mmap64) [_LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T]: Likewise.
(sys_mprotect): Likewise.
(sys_mremap, sys_madvise, sys_mlockall) [LINUX]: Likewise.
(sys_msync) [MS_ASYNC]: Likewise.
(sys_mctl) [MC_SYNC]: Likewise.
(sys_remap_file_pages, sys_mbind, sys_get_mempolicy) [LINUX]:
Likewise.
* net.c (printmsghdr) [HAVE_STRUCT_MSGHDR_MSG_CONTROL]: Likewise.
(sys_send, sys_sendto): Likewise.
(sys_sendmsg) [HAVE_SENDMSG]: Likewise.
(sys_recv, sys_recvfrom): Likewise.
(sys_recvmsg) [HAVE_SENDMSG]: Likewise.
(printicmpfilter) [ICMP_FILTER]: Likewise.
* proc.c (proc_ioctl) [SVR4 && !HAVE_MP_PROCFS || FREEBSD]: Likewise.
* process.c (sys_clone) [LINUX]: Likewise.
(printwaitn): Likewise.
(sys_waitid) [SVR4 || LINUX]: Likewise.
* signal.c (sys_sigvec) [SUNOS4 || FREEBSD]: Likewise.
(sys_sigaction): Likewise.
(printcontext) [SVR4]: Likewise.
(print_stack_t) [LINUX) || FREEBSD]: Likewise.
(sys_rt_sigaction) [LINUX]: Likewise.
* sock.c (sock_ioctl) [LINUX]: Likewise.
* stream.c (sys_putmsg, sys_getmsg): Likewise.
(sys_putpmsg) [SYS_putpmsg]: Likewise.
(sys_getpmsg) [SYS_getpmsg]: Likewise.
(sys_poll): Likewise.
(print_transport_message) [TI_BIND]: Likewise.
(stream_ioctl): Likewise.
* system.c (sys_mount, sys_reboot): Likewise.
(sys_cacheflush) [LINUX && M68K]: Likewise.
(sys_capget, sys_capset) [SYS_capget]: Likewise.
* term.c (term_ioctl) [TIOCMGET]: Likewise.
* time.c (sys_clock_nanosleep, sys_timer_settime) [LINUX]:
Likewise.
Fixes RH#159310.
2005-06-01 23:02:36 +04:00
printflags ( pmsgflags , flags , " MSG_??? " ) ;
2011-09-01 12:00:28 +04:00
tprints ( " ] " ) ;
1999-02-19 03:21:36 +03:00
}
/* decode return value */
switch ( tcp - > u_rval ) {
case MORECTL :
tcp - > auxstr = " MORECTL " ;
break ;
case MORECTL | MOREDATA :
tcp - > auxstr = " MORECTL|MOREDATA " ;
break ;
case MOREDATA :
tcp - > auxstr = " MORECTL " ;
break ;
default :
tcp - > auxstr = NULL ;
break ;
}
}
return RVAL_HEX | RVAL_STR ;
}
2015-07-21 00:37:24 +03:00
# endif
2013-03-05 19:50:12 +04:00
# endif /* STREAMS syscalls support */