10Sstevel@tonic-gate /*
20Sstevel@tonic-gate * CDDL HEADER START
30Sstevel@tonic-gate *
40Sstevel@tonic-gate * The contents of this file are subject to the terms of the
53446Smrj * Common Development and Distribution License (the "License").
63446Smrj * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate *
80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate * See the License for the specific language governing permissions
110Sstevel@tonic-gate * and limitations under the License.
120Sstevel@tonic-gate *
130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate *
190Sstevel@tonic-gate * CDDL HEADER END
200Sstevel@tonic-gate */
216515Sraf
220Sstevel@tonic-gate /*
23*12391SSurya.Prakki@Sun.COM * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
240Sstevel@tonic-gate */
250Sstevel@tonic-gate
260Sstevel@tonic-gate /* Copyright (c) 1988 AT&T */
270Sstevel@tonic-gate /* All Rights Reserved */
280Sstevel@tonic-gate
290Sstevel@tonic-gate #if !defined(_KMDB) && !defined(_BOOT) && !defined(_KERNEL)
300Sstevel@tonic-gate
31*12391SSurya.Prakki@Sun.COM #include "lint.h"
32*12391SSurya.Prakki@Sun.COM
33*12391SSurya.Prakki@Sun.COM #endif /* !_KMDB && !_BOOT && !_KERNEL */
340Sstevel@tonic-gate
35*12391SSurya.Prakki@Sun.COM /*
36*12391SSurya.Prakki@Sun.COM * The SunStudio compiler may generate calls to _memset; So we
37*12391SSurya.Prakki@Sun.COM * need to make sure that the correct symbol exists for these calls.
38*12391SSurya.Prakki@Sun.COM */
39*12391SSurya.Prakki@Sun.COM #pragma weak _memset = memset
400Sstevel@tonic-gate
410Sstevel@tonic-gate #include <sys/types.h>
420Sstevel@tonic-gate
430Sstevel@tonic-gate #if defined(_KERNEL)
440Sstevel@tonic-gate #include <sys/systm.h>
453446Smrj #elif !defined(_BOOT)
460Sstevel@tonic-gate #include <string.h>
473446Smrj #endif
483446Smrj
493446Smrj #include "string.h"
500Sstevel@tonic-gate
510Sstevel@tonic-gate /*
520Sstevel@tonic-gate * Set an array of n chars starting at sp to the character c.
530Sstevel@tonic-gate * Return sp.
540Sstevel@tonic-gate */
550Sstevel@tonic-gate void *
memset(void * sp1,int c,size_t n)560Sstevel@tonic-gate memset(void *sp1, int c, size_t n)
570Sstevel@tonic-gate {
580Sstevel@tonic-gate if (n != 0) {
590Sstevel@tonic-gate unsigned char *sp = sp1;
600Sstevel@tonic-gate do {
610Sstevel@tonic-gate *sp++ = (unsigned char)c;
620Sstevel@tonic-gate } while (--n != 0);
630Sstevel@tonic-gate }
640Sstevel@tonic-gate
650Sstevel@tonic-gate return (sp1);
660Sstevel@tonic-gate }
67