Kstat_open sets errno to "Not enough space"

I wrote the following test program:
<pre>
int main()
kstat_ctl_t * kc;
perror("1");
kc = kstat_open();
perror("2");
if (!kc) printf("kstat_open failed\n");
</pre>
and got the following output:
1: Error 0
2: Not enough space
Reason I wrote the test was that in another program, I was calling kstat_open() and it was returning NULL with this error, and I wanted to know why. Seems the error is misleading. Any suggestions as to how else I might diagnose my problem, please?

Here are some general rules for error numbers:
<UL>
* For functions in section 2 of the manual, they return success OR they return failure and set errno. You should not check errno after a successful system call. These functions will clearly say in their man page that they set errno and what values it might get.
* For functions in section 3 of the manual, they just return success or failure. In either case, they may or may not change errno. The fact that errno did or did not change tells you nothing about whether they succeeded or why they failed. The man pages for these functions do not show error numbers, so you should not check errno or use perror.
</UL>
Your test shows that kstat_open can set errno to ENOMEM even when the open succeeds. This happens when kstat works to figure out how much buffer space it needs, and it is expected behavior.
When can kstat_open fail? It will fail if
* the open of /dev/kstat fails
* an ioctl(KSTAT_IOC_CHAIN_ID or KSTAT_IOC_READ) fails
* a call to calloc fails
If you use the truss command, you will get a change to see what system calls libkstat is doing. This might help shed some light on the problem.

Similar Messages

  • Setting up but not enough space on external drive, it says

    I want to back up work files rather than the whole of my hard disc. In Time Machine preferences, I've indicated for it not to back up (library, system files, applications) which leaves a total of 64.2gb to fit onto a 80gb drive. When the process starts, it tells me there's 76gb to transfer onto a drive with a capacity of 74gb.
    Do I need to knock out more files from what needs to be copied or get a bigger drive or have i indicated vital files not to be copied that need to.
    Thanks
    BB

    Your 80GB drive is actually not 80GB as far as OS X is concerned. This has to do with how 1GB/1MB/1kB/1byte is defined. See for instance here:
    http://en.wikipedia.org/wiki/Gigabyte
    Note that TM normally requires 2 or even 2,5 times the size of the data to be backed up for the initial backup.
    As for files not needed to be included, see for instance here:
    http://www.ryanblock.com/2008/05/good-folders-to-exclude-from-time-machine-backu ps/
    Plus search these fora.
    /p

  • Kstat_lookup() failing: "Not enough space"

    Hi,
    I have a peculiar problem. I'm looking up CPU statistics using kstat(), and I'm getting a failure in kstat_lookup() on some machines.
    Here is the relevant code:
    kstat_ctl_t* pKstatCtl;
    kstat_t* pCpuStats;
    if ((pKstatCtl = kstat_open()) == NULL)
    // Handle error...
    if ((pCpuStats = kstat_lookup(pKstatCtl, NULL, -1, "cpu_stat0")) == NULL)
    // Handle error...
    ... // kstat_read(), etc.
    I am compiling this program on Solaris 2.6, and it works fine on every 2.6 machine I've used. It is interesting to note that, when I run "truss" on the program and watch the results of iostat(KSTAT_IOC_READ), it returns a number in the range of 600-800. I think this is the number of bytes read.
    When I run this program on a Solaris 2.8 machine (without recompiling it there, for reasons which are too complicated to explain here), it works most of the time. However, one of these 2.8 machines is having problems. The kstat_lookup() call fails, and strerror(errno) returns "Not enough space". Note that it's not the kstat_read() that's out of space, it's kstat_lookup(). I tried running the program on another 2.8 machine in the same cluster, and it worked. However, truss told me that ioctl(KSTAT_IOC_READ) was returning 264752.
    What's going on here? Why is kstat_lookup() failing with "Not enough space"? Why does this work on one machine and not another?
    Thanks,
    Chris

    Jason - the discs may be advertised as having 4.7GB of space, but in fact this is a bit of an urban legend - it all depends on how you count the bits, in groups of 1000 or in groups of 1024. Disc manufacturers like to count in 1000's, which gives a larger capacity, whereas your computer will count in groups of 1024...
    If you allow 4.37GB per disc, you'll be much nearer the mark.

  • Not enough space on HD to set up Photos

    I keep trying to set up Photos and after 5 or 6 hours, I get a message that says there is not enough space on my HD to complete the setup.
    I thought that Photos did not need massive amounts of HD space to set up?
    I have about 128 Gb of space on my HD and Photos is saying it needs an additional 108 Gb to complete the operation.

    I have the same issue.
    If I turn on iCloud Library - then I assumed the original photos would be uploaded and my full library would be kept on my Mac. However, a message says that I only have enough space to keep an optimised library on my Mac. So if it is uploading, is it then deleting photos from my Mac at the same time? And then does this mean I only have low resolution photos on my Mac until I download them? It's a bit confusing.

  • My Lacie external hard drive will not back up on Time Machine. Says there's not enough space. This has happened with every single external I've purchased. Thought TM was supposed to delete old backups??

    My Lacie External backed up on Time Machine after the first back up but now says there's not enough room. I thought TM deleted old back ups to save new versions. What am I doing wrong. This happens to me constantly. Every single external hard drive I've purchased for the MacBook Pro (5 of them) has not worked either initially or at the second back up. It either isn't formatted properly so I have to go to Genius bar to help me set up for the first back up, or after the first back up, it says there's not enough space and I have to go back to Genius Bar. Is there a way I can fix this on my own?

    I just purchased 2 external hardrives. a LaCie Minimus and a G Drive. Each 1 TB. The guy at Apple told me that would provide 2 good TM backups for me. My internal HD has 750 GB capacity, of which I'm using 700 GB. Perhaps the ratio is not great enough. I do wish they would have told me this before I purchased the two Bummmmer! I even had them format and get the first back-ups going because of issues I've had in the past. I also just bought a 750 GB for photos.
    So, I won't be able to buy another bigger external since I've just purchased 3. Ugh. Well, I'll just exclude some files and divide things up. Eventually, I just want my 20,000 iphotos on one of the 1TB externals, and a TM back-up on another so that iphoto will function once more. It really hates how many photos I have and is brutally punishing me for it.I seriously need to do some housecleaning!
    Thanks for the advice. Just moved from US to Australia last week and was hoping to upload a few photos and the domino effect has lead me to this. Just went to Genius Bar in Perth today and they told me how to reformat drive to transfer iphoto library over, but I got stuck at trying to back-up my TM.

  • I have a ipod touch and i got it for christmas with an iTunes card .the problem is that i downloaded videos and now it said that there is not enough space and i only downloaded 8 and now 5 don't download how do i erase them.can  get my money back

    i have a ipod touch and i got it for christmas with an iTunes card .the problem is that i downloaded videos and now it said that there is not enough space and i only downloaded 8 and now 5 don't download how do i erase them.can  get my money back

    Whatever you read about iTunes is wrong unless you're actually referring to feature movies, not videos. Videos, apps, music and iBooks you can re-download:
    http://support.apple.com/kb/ht2519
    Download to your computer and then sync to your iPod touch whatever will fit.
    And no, I can't say with certainty that they won't give you a refund, but it's unlikely. The most probable outcome, if you do indeed mean movies, not TV shows or other videos, is that they would set up an additional download. For other content they'll probably just direct you to the same instructions on re-downloading I just posted.

  • After accepting update to my time capsule, I can no longer complete a backup because there is not enough space.  I tried deleting old files, but it doesn't seem to work.  Any advice:

    My time capsule was updated through an apple download update on June 16, and now I cannot back up my computer.  The message is that there is not enough space.  I tried deleting my files, but it didn't help.  any suggestions?

    How much space is there according to airport utility?
    TM can be fussy.. Do a factory reset of the TC and give it a new name. Use short, no space and pure alphanumeric type names..
    And reset TM. See A4 here. http://pondini.org/TM/Troubleshooting.html
    Then set up TM again to the TC and see if TM will start .. the reset will not hurt the backup and TM can still find it on a renamed TC.

  • Write: 0xecf6eb0, 4096: There is not enough space on the disk.

    Our applications occasionally get the error in the function specified by set_errcall: "[prefix] write: 0xecf6eb0, 4096: There is not enough space on the disk. " Preceded by "DB00.db: write failed for page"
    There most certainly is enough space on disk for one. In this most recent case, the Db::put's succeeded for a full hour before finally failing with an out of space error. At which point, I now have 30 log files and my own log files are filled with Berkeley error callbacks.
    How come the set_errcall doesn't return an integer error code? If it did, we would be able to analyze that and decide any action to take. In this example, I might consider closing down all handles and checkpointing then removing logs since maybe the number of logs has gotten to large. Analyzing a string doesn't make sense since that might change with Berkeley versions.
    Anyway, can anyone give any advice as to why we would get an out of space error (with plenty of disk space.) And also how to handle such an error.
    Edited by: AMARCIONEK on Jun 3, 2009 10:10 AM

    The platform is C++ API version 4.7.25 running on Windows Server 2003 Enterprise SP2. The database is on an NTFS disk. We have tested database files up to 20GB in size. The following is my config.
    m_pDbEnvironment->set_cachesize(0, 10 * 1024 * 1024, 1);
    m_pDbEnvironment->set_lg_max(20000000);
    m_pDbEnvironment->set_lg_bsize(10 * 1024 * 1024);
    m_pDbEnvironment->set_mp_max_write(4, 0);
    m_pDbEnvironment->set_mp_mmapsize(2 * 1024 * 1024);
    m_pDbEnvironment->set_mp_max_openfd(1);
    // set the alloc methods into the environment
    m_pDbEnvironment->set_alloc(QPRT_ALLOC, QPRT_REALLOC, QPRT_FREE);
    m_pDbEnvironment->set_lk_detect(DB_LOCK_YOUNGEST);
    m_pDbEnvironment->set_timeout(500000, DB_SET_LOCK_TIMEOUT);
    m_pDbEnvironment->set_timeout(200000, DB_SET_TXN_TIMEOUT);
    m_pDbEnvironment->set_flags(DB_REGION_INIT, 1);
    m_pDbEnvironment->set_tx_max(5000);
    m_pDbEnvironment->set_flags(DB_TXN_WRITE_NOSYNC, 1);
    m_pDbEnvironment->log_set_config(DB_LOG_ZERO, 1);
    m_pDbEnvironment->set_lk_max_lockers(5000);
    m_pDbEnvironment->set_lk_max_locks(5000);
    m_pDbEnvironment->set_lk_max_objects(5000);
    m_pDbEnvironment->open((zKSz)sPath,     DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL |
                                       DB_THREAD | DB_INIT_TXN | DB_RECOVER | DB_LOCKDOWN,
                                       0);
    We also checkpoint every 2 to 5 minutes with a 5MB threshold. We also explicitly call pDbEnvironment->log_archive(kpNil, DB_ARCH_REMOVE) after checkpointing.
    Primary and (up to 4) secondary databases are opened with DB_CREATE | DB_AUTO_COMMIT flags.
    I'd also appreciate any suggestions as to how to lower the memory footprint used by Berkeley. Ever since we've integrated this DB, our memory usage has been too large and inconsistent. There are 6 independent environments the product uses during runtime. Each of these environments have a primary database and (up to 4) secondary databases, which are all opened with DB_CREATE | DB_AUTO_COMMIT flags.
    Just recently we have added a memp_trickle every 5 seconds at 40% (Anything lower and it has no affect in the environment, in other words, db_stat shows dirty pages forced from the cached instead of trickled.) We are trying to reproduce this issue at this point.

  • Not Enough Space in iTunes Library

    I just managed to restore my iPod Mini.. updated it's software etc.
    I keep getting this error box everytime I wanna sync all of my playlist/smartplaylist...
    "The iPod "iPod" cannot be updated because there is not enough space to hold all the items in the iTunes Library. Would you like iTunes to choose a selection of songs to sync with this iPod"
    Now...
    1. I have more than enough space in my drive... so I don't know what's this message about..
    2. I don't need iTunes to choose a selection of songs...cos I wanna do it myself...
    Any idea how to get around this problem???
    Thanks..

    1. I have more than enough space in my drive... so I don't know what's this message about..
    It's saying that your iTunes Library is too large to fit on your iPod. How large is your library? (iTunes will show the size at the bottom of the main Library window if you click on the main library icon at the left of iTunes)
    2. I don't need iTunes to choose a selection of songs...cos I wanna do it myself...
    Set iTunes to manual management of your iPod.

  • Can't download itune movie, not enough space 6gig available?

    Can anyone help, I have approx 6 gig of space available, but I cannot download a movie I purchased from iTunes, I get the message not enough space available, use settings to manage?

    Both are true.
    Your have lost of iCloud space.
    The problem is you need space on the iPhone.
    On the iPhone
              Setting > General > Usage select Storage
    See what is taking up space on the iPhone.
             Delete what you don't need.

  • Error for 'not enough space' when downloading a video.  I can see that it's music but I'm deleting songs out of my itunes and it's not helping with the space.

    I'm trying to download vide'os to my iPad but I'm getting an error that there is 'not enough space'.  When I look at my space, it's mostly music.  I've deleted out albums from my itunes but it has not freed up any space.  How do I delete these albums?

    Music takes up very little space, movies use a lot of space.
    Settings, music
    Setting, usage
    Both these area will give you info but if the movies are bigger then these areas allow, you may not have enough room even with removing all the music.
    How big are these movies and how many?

  • Can't build packages not enough space [Solved]

    I'm trying to compile latest -ck kernel but after it gets built I get an error saying: there is not enough space to build package.
    I remember that last time I was compiling the kernel, I've set-up so that /tmp is loaded in memory or something like that..
    And now when I try to compile the kernel, even though I choose menuconfig I still don't get in ti, to turn it off or even check what it was.
    My /tmp just have 1,3GB free space left, so that could be it, but I doubt it...
    Last edited by Primoz (2010-06-03 11:46:33)

    fukawi2 wrote:
    Copy paste the actual error message and surrounding test (eg, the output from makepkg) would be helpful.
    EDIT: Spelling
    Yeah I tought so... Sorry for not including it in my OP, but I've just done it then and forgot to copy-paste and didn't want to do it again.
    /bin/sh: line 0: echo: write error: No space left on device
    make[1]: *** [crypto/lrw.ko] Error 1
    make: *** [modules] Error 2
    ==> ERROR: Build Failed.
    Aborting...
    ERROR: makepkg exited with an error (512)
    WARNING: expected package does not exist: /tmp/bauerbill/build/aur/kernel26-ck/kernel26-ck-2.6.34-1-x86_64.pkg.tar.xz
    --> scanning /tmp/bauerbill/build/aur/kernel26-ck for matching packages...
    ERROR: no package found: /tmp/bauerbill/build/aur/kernel26-ck/kernel26-ck-2.6.34-1-x86_64.pkg.tar.xz
    :: Abort? [Y/n]
    aborting...
    That's what happens, but I think it is problem with root, as when this happens there's only 9,7MB free space left.
    I guess I have either remove unneeded packages or make root bigger...

  • Trying to upgrade to newest version of iPad software but not enough space on hard drive to backup the iPad. It is saying if I continue all content on iPad will be deleted! Can I get it back after uprade by just synching with itunes?

    Trying to upgrade iPad software to newest version. It downloads but stops while backing up and says not enough space on hard drive to back up if i continue all media on iPad will be lostor deleted.  Can I get it back after upgrade by just synching or can I set it to backup to an external drive?  Thanks for any help.  I only use the laptop for itunes now as it has such little space left.

    I would recommend deleting contents off your hard-drive to make space (how much is left..you should be having 15% free as a general practice) and backing up the phone prior to upgrading.

  • DPM is out of disk space for the replica. (ID 58 Details: There is not enough space on the disk (0x80070070))

    I constantly get these message on laptop backup, what actually does it mean?
    DPM is out of disk space for the replica. (ID 58 Details: There is not enough space on the disk (0x80070070))
    I set automatic growth on protection group and there is plenty space.

    Auto-grow Key Points
    1.) Auto-grow needs to be enabled for the datasource.
    2.) We grow the replica/recovery point volume by 10gigs or by 25% whichever is higher.
    3.) To prevent race conditions, we do not grow within 15 minutes of the last growth.
    http://social.technet.microsoft.com/Forums/ru-RU/6c70079e-6d90-42e2-89c4-9ddc7fcf11f4/dpm-2012-is-out-of-disk-space-auto-growth-does-not-work
    https://blogs.technet.com/b/dpm/archive/2011/06/06/how-to-use-and-troubleshoot-the-auto-heal-features-in-dpm-2010.aspx
    http://robertanddpm.blogspot.ru/2010/09/shrink-volumes-auto-grow.html
    Have a nice day !!!

  • Not enough space on temporary disk error

    Error Executing Database Query.[Macromedia][SequeLink JDBC
    Driver][ODBC
    Socket][Microsoft][ODBC Microsoft Access Driver] Not enough
    space on temporary
    disk. I am running CF MX 7 on Win2k3.
    The only fix so far is to restart all the CF processes and
    flush the Caching in Server settings in CFMX 7. Anyone have an idea
    what is wrong?
    Here is the error on all my webpages that execute a database
    query.
    [Macromedia][SequeLink JDBC Driver][ODBC
    Socket][Microsoft][ODBC Microsoft Access Driver] Not enough space
    on temporary disk.

    I totally understand your wish to get to the bottom of this!
    There are a lot of factors that can be contributing to the problem
    - the query itself, the number of users hitting the query, and the
    tmp files internal to Access.
    Make sure your query isn't returning very large recordsets
    (e.g. all sales for all salespersons for all year.....). Even a
    query with a moderate recordset return , hit by a large number of
    users, can cause this sort of problem.
    If you must use Access in production (which is NOT
    recommended) your datasource settings should include:
    Maintain connections across client requests be unchecked.
    Limit Connections be checked and Restrict connections to be
    set to 1
    These settings should help prevent performance issues.

Maybe you are looking for