malloc: errno: 22: Invalid argument
Hello FreeBSD answers, I am a maintainer of a dhcp analysis software, which is before exit checking errno. I got report from FreeBSD user, Roar who is CC:d, that my software is reporting invalid argument at that section of the program. After sending debugging messages back and forth issue was pinpointed to following code sample. -- snip #include err.h #include errno.h #include stdlib.h int main(void) { int *i; warn(errno: %d, errno); i = malloc(sizeof(int)); warn(errno: %d, errno); free(i); return (errno); } -- snip which will give following output: # ./a.out a.out: errno: 0: Unknown error: 0 a.out: errno: 22: Invalid argument Characteristics of the system are; FreeBSD 8.2-STABLE # gcc -v Using built-in specs. Target: i386-undermydesk-freebsd Configured with: FreeBSD/i386 system compiler Thread model: posix gcc version 4.2.1 20070719 [FreeBSD] /lib/libc.so.7 There is no malloc.conf file on system. I don't understand why the invalid argument is set. I do not feel comfortable to write 'if the system is FreeBSD do not care malloc related errno 22' to my code. That simply sounds wrong. Does someone have explanation what might be going on and/or advice how I should deal this thing in the code? Or is the whole thing some how environment related? Unfortunately I don't have FreeBSD installation. So even if you would not be a malloc specialist you can say reply and tell that the sample is or is not setting invalid argument. That will be evidence that the problem happens either on none, some or all other systems as well. Thanks in advance for help. -- Sami Kerola http://www.iki.fi/kerolasa/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Mailing list etiquette (Was: Re: Linksys-E4200 Wireless N-router)
--As of April 8, 2011 3:50:52 PM -0600, Chad Perrin is alleged to have said: You seem to fail to realize that it's possible to CC someone who isn't on the list, but not CC someone who *is* on the list. That would be why people who aren't members of the list say thinks like please CC me, while people who are members occasionally say please don't send duplicates to me. --As for the rest, it is mine. Of course that's hard to keep track of, and a manual process on the part of the persons sending the messages. ;) (And if it's not mentioned in the specific email you are replying to, you either have to rely on memory or guess.) I've seen a variety of other solutions to this. Some mailing lists programs will even check to see if the message has been sent to you directly, and if so avoid sending another copy to you. Usually that's an option, and I tend to turn it off: It just means my filters don't work on the message I get. If you have an email client that supports it, there is one good way to reliably indicate your preference: The 'Reply-To:' header. I set mine to the mailing list when sending to the list. Nearly all mail clients will then automatically send replies to that address. Of course, that only works if I have a mail client that lets me set that header independently. My at-home client does, but I also access my email over webmail. The webmail program technically can do it, but it's interface is *very* poor. (Squirrelmail: It allows it via profiles, but all profiles are named by the sender address, unchangeable. For this use-case, the sending address is the same for all profiles.) And while *most* email clients support replies to the Reply-To address, not all do. Nor does it help if people are habitually hitting reply-all. Still, I find setting the Reply-To address works better than most of the other options. It doesn't work 100% of the time, but then neither does anything else. (Including address rewriting by the mailing list.) So, if getting two copies is annoying you, try it. You'll at least have made your preference known, without imposing it on others as their preference. Daniel T. Staal --- This email copyright the author. Unless otherwise noted, you are expressly allowed to retransmit, quote, or otherwise use the contents for non-commercial purposes. This copyright will expire 5 years after the author's death, or in 30 years, whichever is longer, unless such a period is in excess of local copyright law. --- ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: malloc: errno: 22: Invalid argument
-- snip #include err.h #include errno.h #include stdlib.h int main(void) { int *i; warn(errno: %d, errno); i = malloc(sizeof(int)); warn(errno: %d, errno); free(i); return (errno); } -- snip Your code is wrong. There's only a useful value in errno after something fails. This would be more reasonable: int main(void) { int *i; /* warn(errno: %d, errno); -- no error, nothing to check */ i = malloc(sizeof(int)); if(!i)warn(errno: %d, errno); /* only warn on failure */ free(i);/* -- free ignores NULL argument */ return (0); /* -- free cannot fail, no meaningful errno */ } This isn't specific to FreeBSD, by the way. It's ANSI C. Regards, John Levine, jo...@iecc.com, Primary Perpetrator of The Internet for Dummies, Please consider the environment before reading this e-mail. http://jl.ly ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: FreeBSD VMWare Mac screen resulution and keyboard map
On Fri, 8 Apr 2011, Sascha Vieweg wrote: As a curious beginner I am running FreeBSD on VMWare Fusion 3.1.2 on a MacBook Pro 13'' i5, and I want to do two things on the normal (startup) console: (1) use my apple keyboard, especially, scroll through console output man syscons | less -p'Back Scrolling' (2) have a screen resolution of at least 800x600. vidcontrol(1) can set different modes, potentially including VESA_800x600. What's available depends on the video card BIOS and you'll probably have to build a kernel with SC_PIXEL_MODE. Both things seem to be no particular problem in X11, however, I cannot find advices for the normal console. Unless you're trying to emulate a machine without X11 for a particular purpose, xterms are more versatile than consoles. It's probably possible to get a console-like stack of fullscreen xterms with one of the mouseless window managers. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: malloc: errno: 22: Invalid argument
On Sat, Apr 9, 2011 at 16:43, John Levine jo...@iecc.com wrote: Your code is wrong. There's only a useful value in errno after something fails. This would be more reasonable: int main(void) { int *i; /* warn(errno: %d, errno); -- no error, nothing to check */ i = malloc(sizeof(int)); if(!i)warn(errno: %d, errno); /* only warn on failure */ free(i); /* -- free ignores NULL argument */ return (0); /* -- free cannot fail, no meaningful errno */ } This isn't specific to FreeBSD, by the way. It's ANSI C. Different systems seem to work different ways. Indeed you are right, the behavior of operating system setting errno when malloc is successful is allowed. http://pubs.opengroup.org/onlinepubs/009695399/functions/errno.html http://pubs.opengroup.org/onlinepubs/009695399/functions/malloc.html Perhaps it was just a naive beginner expectation that errno is not set by functions when they are successful. I'll remove the check from the end of the program since there is no guarantees it would mean anything sensible. -- Sami Kerola http://www.iki.fi/kerolasa/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Mailing list etiquette
On Fri, 8 Apr 2011 23:38:26 +0100 Bruce Cran wrote: On Fri, 8 Apr 2011 23:15:11 +0200 Erik Trulsson ertr1...@student.uu.se wrote: You seem to miss one crucial fact: Not all the people who write to this list are subscribed to it. They will not see any replies directed only to the list. It is for their benefit that that rule exists. I don't know about anyone else, but personally I like getting replies CC'd to me because they end up in my INBOX - otherwise I often don't notice someone's replied since there are so many new messages to the mailing list each day. +1 Since I'm subscribed to almost a hundred maillist I should admit that this rule is *very* helpfull to speed up conversation. -- WBR, bsam ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
shell programming question: help with expr command
Hi folks, I'm having trouble with a little shell script. Can somebody explain me why I get 3 times expr: syntax error in my console after I run this little script? #! /usr/local/bin/bash # testscript var1=trees.J48 #other value will be rules.Jrip, rules.DecisionTable len=${#var1} ind=`expr index $var1 s` pos=`expr $len - $ind` out=`expr substr $var1 $ind $pos` I would expect (and want the following to happen): $ind should contain 6 $pos should contain 3 $out should contain J48 (other values will have to be Jrip,DecisionTable) Can anyone help me with this? Thanks ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: shell programming question: help with expr command
On Sat, 9 Apr 2011 06:31:28 -0700 (PDT), Dino Vliet dino_vl...@yahoo.com wrote: Hi folks, I'm having trouble with a little shell script. Can somebody explain me why I get 3 times expr: syntax error in my console after I run this little script? #! /usr/local/bin/bash # testscript var1=trees.J48 #other value will be rules.Jrip, rules.DecisionTable len=${#var1} ind=`expr index $var1 s` pos=`expr $len - $ind` out=`expr substr $var1 $ind $pos` I would expect (and want the following to happen): $ind should contain 6 $pos should contain 3 $out should contain J48 (other values will have to be Jrip,DecisionTable) Can anyone help me with this? The explaination is quite simple: expr doesn't know index or substr; see man expr for details. A polite sidenote: Unless you have a good reason to code in bash-specific manner, do NOT #!/usr/local/bin/bash, as this is NOT portable (if this is one of your goals); use the standard #!/bin/sh instead. Depending on what you have in mind, maybe mentioning the strengths of perl, sed and awk is worth being mentioned. :-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ... ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: shell programming question: help with expr command
On Apr 9, 2011, at 6:31 AM, Dino Vliet dino_vl...@yahoo.com wrote: Hi folks, I'm having trouble with a little shell script. Can somebody explain me why I get 3 times expr: syntax error in my console after I run this little script? #! /usr/local/bin/bash # testscript var1=trees.J48 #other value will be rules.Jrip, rules.DecisionTable len=${#var1} ind=`expr index $var1 s` pos=`expr $len - $ind` out=`expr substr $var1 $ind $pos` I would expect (and want the following to happen): $ind should contain 6 $pos should contain 3 $out should contain J48 (other values will have to be Jrip,DecisionTable) Can anyone help me with this? This would be a /bin/sh compatible (read: portable) way to accomplish the above: #!/bin/sh # testscript var1=trees.J48 #other value will be rules.Jrip, rules.DecisionTable len=${#var1} ind=`echo $var1 | awk '{print index($0,s)+1}'` pos=$(( $len - $ind )) out=`echo $var1 | awk -vind=$ind -vpos=$pos '{print substr($0,ind+1,pos)}'` Though, there are certainly easier ways to get at what it is that I assume your after: #!/bin/sh # testscript var1=trees.J48 #other value will be rules.Jrip, rules.DecisionTable out=${var1##*.} -- Devin Thanks ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org _ The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you. _ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: SSHD Strangeness
On Fri, Apr 8, 2011 at 5:15 PM, ill...@gmail.com ill...@gmail.com wrote: On 8 April 2011 15:22, Scott Ballantyne s...@ssr.com wrote: I've never seen this before, but when ssh'ing to my server today, I got: ssh_exchange_identification: Connection closed Was this multiple log-in failures receiving the same error message? is this log-in happening across the internet or is this on your local network? Not sure what you mean by 'multiple log-in failures'. I tried many times, each with the same result, if that's what you are asking. It was happening across the internet and also locally. When I logged into the server with my vendors KVM tool, I tried ssh'ing to from the server to the server, and got the same message. I thought there might have been a break-in, but who and 'w' didn't show anyone logged in that shouldn't have been there. I killed all the sshd processes and restarted it, that didn't help. ps -auxww did show a few, not many, sshd's in various states of connectedness. I'm wondering if this is some kind of denial-of-service attack opportunity. That's the only thing I can think of at the moment. I'm not using the host allow/deny stuff, and unfortunately did not think to use ssh -W. Thanks! Scott -- s...@ssr.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: SSHD Strangeness
On 9 April 2011 13:22, Scott Ballantyne s...@ssr.com wrote: On Fri, Apr 8, 2011 at 5:15 PM, ill...@gmail.com ill...@gmail.com wrote: On 8 April 2011 15:22, Scott Ballantyne s...@ssr.com wrote: I've never seen this before, but when ssh'ing to my server today, I got: ssh_exchange_identification: Connection closed Was this multiple log-in failures receiving the same error message? is this log-in happening across the internet or is this on your local network? Not sure what you mean by 'multiple log-in failures'. I tried many times, each with the same result, if that's what you are asking. It was happening across the internet and also locally. When I logged into the server with my vendors KVM tool, I tried ssh'ing to from the server to the server, and got the same message. I thought there might have been a break-in, but who and 'w' didn't show anyone logged in that shouldn't have been there. I killed all the sshd processes and restarted it, that didn't help. ps -auxww did show a few, not many, sshd's in various states of connectedness. I'm wondering if this is some kind of denial-of-service attack opportunity. That's the only thing I can think of at the moment. I guess if the login name you are using is fairly obvious the script kiddies may be triggering the limit of MaxAuthTries I grokn't C, but your error is coming from http://svn.freebsd.org/viewvc/base/stable/8/crypto/openssh/sshconnect.c?revision=206984view=markup ( http://is.gd/UGXcP0 ) HTH -- -- ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Mailing list etiquette (Was: Re: Linksys-E4200 Wireless N-router)
___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Re: Difficulty installing 8.2 stable.
Another addendum: I used the sysinstall debugger on tty1 to determine that my tarball files were not unzipped during the ISO image extraction from the .bz file. Does anyone know how I can both extract the ISO image and uncompress the tarballs without destroying the image? On Fri, Apr 8, 2011 at 2:06 PM, lottami...@yahoo.com wrote: Addendum: During the installation, I did get error messages that indicated certain files were not being found, however I did use the complete DVD ISO image, which I believe should have included everything and, to make sure, I selected every package for installation. Also, the reference to Windows was for the other machine (an older Toshiba using Vista, not 7) on which I had burned the image disk (I completely eliminated the Windows 7 partition on the newer machine prior to installation). On Fri, Apr 8, 2011 at 1:57 PM, lottami...@yahoo.com wrote: To All: I installed 8.0 last year with no trouble at all. However, this year, I put it on a new machine (Toshiba laptop A505-S6981 running Windows 7) but I can't seem to get any of the port packages to install. This time I used a DVD ISO image, rather than a CD-ROM as before. It seems like sysinstall can't find necessary dependencies, although it does appear to have loaded the packages (e.g., X11) into the proper directories. Any idea what is going on? Thanks. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
Problem with an ATI x2900 video adapter
Good Day; I am in the final steps of completing a fresh installation of FreeBSD 8.2 on a workstation with a DFI LanParty motherboard, AMD Athlon 64 processor, 3 GB of ram, an ATI Radeon x2900 graphics card, and root on ZFS filesystem. Using ports.tar.gz downloaded, and src CVSup'd this morning, gnome2 is still compiling and installing. While I did have some minor issues with the build of some dependencies, it was nothing I could not work through. I was surprised this afternoon when, while the installation of gnome2 was working, I think it was building GCC 4.4 and friends, the HP 2010i LCD monitor I use on the machine appeared to lose the input to its DVI port. The HD activity light was still flickering so I let it continue and waited a hour or so for it to quit indicating activity before I pressed the reset button. The PC restarted and no filesystem errors were apparent on restart. I would like to know if anyone else has experienced this or, if a PR is necessary against the Xorg radeon driver. The ATI Catalyst utility needs windows or linux and I have neither. There is nothing of value in dmesg or Xorg.0.log $ uname -a FreeBSD rainey 8.2-RELEASE FreeBSD 8.2-RELEASE #0 r219081M: Wed Mar 2 08:29:52 CET 2011 root@www4:/usr/obj/usr/src/sys/GENERIC amd64 Thank You, Michael PS; Many thanks to the maintainer of the mfsBSD zfsinstall .iso. It worked flawlessly for setting up this system. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
ZFS Striping and Optimizing Capabilities
Just a few questions about what ZFS actually does. So if anyone has intimate knowledge about ZFS's implementation on Freebsd I'm sure I and others would appreciate the answers. When you add a second and or thrid drive/partition to a zpool I'm assuming that it's going to start using the drives like a raid 0 stripe. How do the ZFS versions differ in this? Does it immediately start striping all files in the background on low priority or does it do it as files are accessed? Does ZFS in any way do performance testing of read/right operating in light of where the data is stored on the drive? i.e. the outside sectors of hard drives perform faster. If it does do read/write location testing can it be shut off or does it detect SSDs? What about tracing application sector reading and reordering sectors so that they follow one another according to typical usage? i.e. the sectors are already in the linear read ahead buffer? I appreciate any answers, Chris ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org