membarrier.c revision 38a34c9349267c99ce1ddbd0b6e985147415d355
13ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* 23ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org> 33ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * All rights reserved. 43ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * 53ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * Redistribution and use in source and binary forms, with or without 63ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * modification, are permitted provided that the following conditions 73ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * are met: 83ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * 1. Redistributions of source code must retain the above copyright 93ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * notice, this list of conditions and the following disclaimer. 103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * 2. Redistributions in binary form must reproduce the above copyright 113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * notice, this list of conditions and the following disclaimer in the 123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * documentation and/or other materials provided with the distribution. 133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * 3. The name of the author may not be used to endorse or promote products 143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * derived from this software without specific prior written permission. 153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * 16de984cdc3631106b1cbbb8d3972b76a0fc27e8e8cristy * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20b56bb24a985ca4366713bcd8ffdfacbb48a98a2fcristy * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy */ 273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include "defs.h" 293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include "xlat/membarrier_cmds.h" 313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 323ed852eea50f9d4cd633efb8c2b054b8e33c253cristySYS_FUNC(membarrier) 333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{ 343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy if (entering(tcp)) { 353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy int cmd = tcp->u_arg[0], flags = tcp->u_arg[1]; 363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy printxval(membarrier_cmds, cmd, "MEMBARRIER_CMD_???"); 383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy tprintf(", %d", flags); 393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy 403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy return cmd ? RVAL_DECODED : 0; 413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy } 424c08aed51c5899665ade97263692328eea4af106cristy 434c08aed51c5899665ade97263692328eea4af106cristy if (syserror(tcp) || !tcp->u_rval) 444c08aed51c5899665ade97263692328eea4af106cristy return 0; 454c08aed51c5899665ade97263692328eea4af106cristy 464c08aed51c5899665ade97263692328eea4af106cristy tcp->auxstr = sprintflags("", membarrier_cmds, tcp->u_rval); 474c08aed51c5899665ade97263692328eea4af106cristy return RVAL_HEX | RVAL_STR; 484c08aed51c5899665ade97263692328eea4af106cristy} 49007e925e29fea767305ade6e1d635e5e517a13b3dirk