Sponsored Content
Full Discussion: Memset fails on Solaris
Homework and Emergencies Emergency UNIX and Linux Support Memset fails on Solaris Post 302922322 by DGPickett on Thursday 23rd of October 2014 05:08:52 PM
Old 10-23-2014
Might go haywire if called with n loaded from negative integer ( -1 = 0xFFFFFFFF )?
Code:
void *memset( void *dst, int c, size_t n ){
 
    char *d = dst;
 
    while ( n ) {
         --n ;
         *d  =  c  ;
         d++ ;
     }
 
     return dst;
 }

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Solaris 2.6 exec login fails

Ladies and Gentlemen; I need your help in determining what has happened to one of my companies systems. Here is the scenario: System Ultra 5 with Solaris 2.6 and the latest patch cluster installed. Third party security person "hardened" the system yesterday.... (2 Replies)
Discussion started by: rambo15
2 Replies

2. Programming

about memset fuction

Dear all, In my code,i am planning to use memset function to re-initialise an array before populating it everytime. Will using memset function be an overload to the program? (3 Replies)
Discussion started by: ranj@chn
3 Replies

3. UNIX for Dummies Questions & Answers

pkgadd fails when installing Solaris 8 patches

Hi, guys ! I usually run this task without even thinking on outcome, because it never failed. But this time when I tried installation of patches for Solaris 8 OS on my old machine, I received this message: "pkgadd: ERROR: no packages were found in </var/spool/pkg>" I compared the contents... (5 Replies)
Discussion started by: Deicide5997
5 Replies

4. UNIX for Dummies Questions & Answers

questions in memset

HI all , please find the piece of code below char *t; char *f; char buf; memset(buf,0,50); after that i am assigning memory for (i=0; i<100; i++) { t = buf+(i*6); f = "ARUN"; } my question .. 1) i have run this it is... (7 Replies)
Discussion started by: arunkumar_mca
7 Replies

5. UNIX for Advanced & Expert Users

memset vs calloc

Dear Friends, Can any one tell me the difference between memset and calloc function in C. Regards, Selvi (7 Replies)
Discussion started by: salvi
7 Replies

6. Solaris

ldap client fails to start under solaris 10

I have an issue here with ldap client. It stoped and won't start. What I have got: sadm $ tail /var/adm/messages Apr 16 09:17:24 hostname inetd: libsldap: Status: 2 Mesg: Unable to load configuration '/var/ldap/ldap_client_file' (''). Apr 16 09:17:24 hostname inetd: libsldap: Status: 2 ... (3 Replies)
Discussion started by: aixlover
3 Replies

7. Solaris

Solaris 10 install fails on sparc

I'm trying to do an upgrade/install from Solaris 8 to Solaris 10 on a SUN Sparc system. I halt the system, as documented, but when I attempt to boot off the distribution DVD; i.e. halt : : OK> boot cdrom The system indicates that the device is 'unrecognizable' These are SUN... (5 Replies)
Discussion started by: imagtek
5 Replies

8. Programming

C bzero() to memset() issue

Hi guys, my tool works fine in gentoo, ubuntu now im trying to port it to windows but bzero/bcopy I read aren't working on windows and for better portability I should of use memset() so im trying to translate bzero(buffer,256);in printf("MAIL TO"); strcpy(buffer, rcp); ... (4 Replies)
Discussion started by: Jess83
4 Replies

9. Solaris

Solaris: clnt_create fails on solaris x86

Hi, I am facing an issue with Solaris x86 machine Machine Details: uname -a SunOS sol10-64 5.10 Generic_137138-09 i86pc i386 i86pc .............................. Description: I am trying to register a programm with proramm ID 300760 with version number 1, and tryint to create a... (0 Replies)
Discussion started by: DivakarAdari
0 Replies

10. Shell Programming and Scripting

awk works on Linux but fails on Solaris

On linux i have the below command working fine. awk '/<app-deploy>/{A=1;++i} /<\/app-deploy>/{print >> "found"i".tmp";A=0} A{;print >> "found"i".tmp"}' deploy.xml But the same is failing on Solaris Output: awk: syntax error near line 1 awk: bailing out near line 1 uname -a SunOS mymac 5.10... (5 Replies)
Discussion started by: mohtashims
5 Replies
MEMORY(2)							System Calls Manual							 MEMORY(2)

NAME
memccpy, memchr, memcmp, memcpy, memmove, memset - memory operations SYNOPSIS
#include <u.h> #include <libc.h> void* memccpy(void *s1, void *s2, int c, long n) void* memchr(void *s, int c, long n) int memcmp(void *s1, void *s2, long n) void* memcpy(void *s1, void *s2, long n) void* memmove(void *s1, void *s2, long n) void* memset(void *s, int c, long n) DESCRIPTION
These functions operate efficiently on memory areas (arrays of bytes bounded by a count, not terminated by a zero byte). They do not check for the overflow of any receiving memory area. Memccpy copies bytes from memory area s2 into s1, stopping after the first occurrence of byte c has been copied, or after n bytes have been copied, whichever comes first. It returns a pointer to the byte after the copy of c in s1, or zero if c was not found in the first n bytes of s2. Memchr returns a pointer to the first occurrence of byte c in the first n bytes of memory area s, or zero if c does not occur. Memcmp compares its arguments, looking at the first n bytes only, and returns an integer less than, equal to, or greater than 0, according as s1 is lexicographically less than, equal to, or greater than s2. The comparison is bytewise unsigned. Memcpy copies n bytes from memory area s2 to s1. It returns s1. Memmove works like memcpy, except that it is guaranteed to work if s1 and s2 overlap. Memset sets the first n bytes in memory area s to the value of byte c. It returns s. SOURCE
All these routines have portable C implementations in /sys/src/libc/port. Most also have machine-dependent assembly language implementa- tions in /sys/src/libc/$objtype. SEE ALSO
strcat(2) BUGS
ANSI C does not require memcpy to handle overlapping source and destination; on Plan 9, it does, so memmove and memcpy behave identically. If memcpy and memmove are handed a negative count, they abort. MEMORY(2)
All times are GMT -4. The time now is 08:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy