1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #pragma init(init) 28 29 #include <s10_brand.h> 30 #include <sys/syscall.h> 31 32 /* 33 * This is a library that is LD_PRELOADed into native binaries. 34 * All it does is one brand operation. B_S10_NATIVE. This brand 35 * operation checks that this is actually a native binary, and then 36 * if so changes the executable name so that it is no longer ld.sol.1. 37 * Instead it changes it to be the name of the real native executable 38 * that we're runnning. This allows things like pgrep to work as 39 * expected. Note, that this brand opration only changes the process 40 * name wrt the kernel. From the processes perspective, the first 41 * argument and AT_SUN_EXECNAME are still ld.so.1. 42 */ 43 44 void 45 init(void) 46 { 47 sysret_t rval; 48 (void) __systemcall(&rval, SYS_brand, B_S10_NATIVE); 49 } 50