/* * Copyright (c) 1997 X/Open Company Ltd., A member of The Open Group * * All rights reserved. No part of this source code may be reproduced, * stored in a retrieval system, or transmitted, in any form or by any * means, electronic, mechanical, photocopying, recording or otherwise, * except as stated in the end-user licence agreement, without the prior * permission of the copyright owners. * * Motif, OSF/1 and UNIX are registered trademarks and X/Open, * the "X Device" and The Open Group are trademarks of The Open Group. * * Developed for X/Open by Applied Testing and Technology, Inc. * * Project: VSRT * * File: tset/rt.os/mlock/mlockall/mlockall4.c * * Modifications: * $Log: mlockall4.c,v $ * Revision 2.0 1997/06/15 19:46:01 andy * Branch point for Release 5.0.0b1 * * Revision 1.1 1997/05/27 18:06:53 andy * Initial revision * */ /*Exec-ed by mlockall.c to test locking as it requires privilege to lock memory*/ #ifndef lint #define MAIN #ifdef MAIN static char sccsid[] = "@(#)rt.os/mlock/mlockall - mlockall4 Rel 4.3.1 (05/18/94)"; char *copyright[] = { "(C) Copyright 1997 X/Open Company Limited", "All Rights Reserved." }; #endif /* MAIN */ #endif /* lint */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include private int tb_mlockall(); private void checkids(); private void subtest4(); int errors = 0; /*from vsrtlib/mkmmap.c*/ extern int vsrt_got_sigsegv; extern int vsrt_got_sigbus; extern int vsrt_got_sig; extern unsigned long vsrt_pgsz; extern unsigned long vsrt_ipgsz; extern int vsrt_setjmp_called; #define test_file "vsrt_mlockall" public int tet_main(argc, argv) int argc; char **argv; { subtest4(); return 0; } private void subtest4() { int fd; int err; int i; int pathok = 0; void *addr; DBUG_ENTER("subtest4"); if (setprv(PRV_MEMLOCK) != 0) { xx_rpt(FAILURE); in_rpt("setprv(PRV_MEMLOCK) failed"); DBUG_VOID_RETURN } if (tb_mlockall(0) != -1) { in_rpt("mlockall(0) succeeded"); xx_rpt(FAILURE); DBUG_VOID_RETURN } if (errno != EINVAL) { vsrt_sysfail("mlockall(0)"); xx_rpt(FAILURE); DBUG_VOID_RETURN } xs_rpt(); DBUG_VOID_RETURN } private int tb_mlockall(flags) int flags; { int retval; retval = mlockall(flags); #ifdef TESTBED errno++; return -1; #else return retval; #endif }