Fopen() on solaris 7 and solaris 8

Hi,
When I am trying to open more than 255 files using fopen()
call, I am getting the different behaviour on solaris 7 and
solaris 8. On sol 7 it returns 0 and errno set to 0. On
sol 8 it returns 0, but errno set to 24. My application is
using value of errno to implement the code to allow users
to open more than 255 files. But it is failing on solaris 8
becoz of the above behaviour. Is there any change in fopen()
call?
I have to fix my application ASAP. Any help in this regard
will be greatly appreciated.
regards,
vinod.

Hi Vinod,
The err no 24 being returned by Solaris 8 is correct.
if rlimit has been adjusted to greater than 256 fds, and
fopen()'s call to open() returns a descriptor value greater
than 255, fopen() used to return NULL but did not set
the errno. hence it was fixed to set the errno to EMFILE
which does correctly say " Too Many open Files".
HTH
Shridhar

Similar Messages

  • Why  difference in Solaris and Linux

    Hi,
    The following program is giving results diferently when I am executing using g++ compiler in Solaris and Linux.
    Why it is so.
    here is the code:
    #include <stdio.h>
    #include <string.h>
    #include <malloc.h>
    #include <stdlib.h>
    int main( void )
    size_t size;
    char *buf;
    if ( ( buf = (char *)malloc(10 *sizeof(char))) == NULL)
    exit (1);
    size = sizeof( buf );
    strcpy(buf, "HelloWorld");
    printf("\n Address is : %u String is : %s size : %d ", buf, buf,size);
    if (( buf = (char *) realloc(buf, sizeof(20))) == NULL)
    exit ( 1);
    *(buf+10) = 'A'; *(buf+11) = 'B'; *(buf+12) = '\0';
    printf("\n Address is : %u String is : %s\n", buf, buf);
    free( buf);
    exit( 0 );
    Solaris:
    Address is : 134160 String is : HelloWorld size : 4
    Address is : 135704 String is : HelloWor
    Linux:
    Address is : 134518824 String is : HelloWorld size : 4
    Address is : 134518824 String is : HelloWorldAB
    Thanks
    Venkat

    Hi,
    The following program is giving results diferently
    when I am executing using g++ compiler in Solaris
    and Linux.
    Why it is so.
    here is the code:
    #include <stdio.h>
    #include <string.h>
    #include <malloc.h>
    #include <stdlib.h>
    int main( void )
    size_t size;
    char *buf;
    if ( ( buf = (char *)malloc(10 *sizeof(char))) == NULL)
    exit (1);
    size = sizeof( buf );The size you get here is the size of buf, which is the size of a pointer, not the size of what buf points to. sizeof(*buf) would give you size of a char, the type (not the object) that buf points to.
    There is no portable way to find out the number of bytes allocated on the heap if you are give only a pointer to the memory. You have to remember the size some other way..
    strcpy(buf, "HelloWorld");A literal string consists of the characters in the string plus a terminating null, all of which are copied by strcpy. You allocated 10 chars for buf, but are writing 11 chars into it. At this point, the program has undefined behavior. Literally anything at all could happen, because you can't predict the effect of writing outside the bounds of allocated memory.
    printf("\n Address is : %u String is : %s size :
    e : %d ", buf, buf,size);
    if (( buf = (char *) realloc(buf, sizeof(20))) == NULL)The "sizeof" operator in this case is returning the size of the type of a literal 20, which is an int. If you want to allocate 20 bytes, you write 20, not sizeof(20).
    exit ( 1);
    *(buf+10) = 'A'; *(buf+11) = 'B'; *(buf+12) == '\0';SInce you can't count on buf having more than 4 bytes at this time, you are writing into unallocated memory, with undefined results.
    printf("\n Address is : %u String is : %s\n", buf, buf);
    free( buf);
    exit( 0 );
    Instead of asking why you get different results on different platforms, you should be asking why the program doesn't crash on all platforms. :-)
    You can avoid these problems with keeping track of allocating memory by using the C++ standard library instead of trying to manage low-level details yourself as in C code.
    The standard string class, for example, extends itself as needed, and ensures that heap memory is freed when the string object is deleted or goes out of scope. You don't need pointers, malloc, free, or sizeof to use C++ strings.

  • Samba and Solaris, access slow via XP

    Hi everyone,
    I've new to solaris and I've installed 10, update 5. I've configured samba (very badly I believe) so that I can access my solaris box from my XP 64 computer.
    Both are on a local network (connected via a Belkin router) and in the same workgroup. I can see the XP machine from solaris, but not access anything (I just get a 'cannot show contents of directory' message). This is not my main problem, since I mostly want to access the solaris system from XP (I want to set up the solaris box as a RAID Z NAS). This works to a degree. I can see and access my solaris filesystem from XP. Hurray. I have two problems:
    1. I have set guest to NO, but I never get asked for a password (I've set up an account on the solaris system with a password using smbpasswd). I just get access. Why is this? I don't want a bunch of ner-do-wels skulking about my server and erasing files and such.
    2. While I can stream music fine, after a minute or so, if I want to browse files from XP it stalls for about one minute (I think it is re-logging in) and while this happens any music being streamed stops. How do I stay connected and logged in? Here is my smb.conf:
    # Samba config file created using SWAT
    # from 192.168.2.3 (192.168.2.3)
    # Date: 2008/05/11 18:46:15
    [global]
         socket options = TCP_NODELAY SO_KEEPALIVE IPTOS_LOWDELAY
         ldap ssl = no
    [home]
         read only = No
         guest ok = No
         available = No
    [homes]
         valid users = %S
         read only = No
         guest ok = No
    As you can tell I'm pretty new to all this so you may have to dumb down your answers a little. Thanks for the help.
    Cisco

    Yup.....repeatable!
    Delete mapped drive.
    Connect via USB
    Playbook shows in windows explorer as PlayBook [Pin: number] Y:  being the drive that XP has mapped it to.
    Then search for the PlayBook by ip address \\192.168.1.x
    It shows up under workgroup by its ip address
    Disconect USB cable
    Workgroup connect remains (via wifi)
    Strange to say the least.

  • Why keyboard and mouse right click not working in Solaris and Linux?

    Hi all,
    I have two problems:
    1) I am working on AWT/Swing application and its working fine in window enviornment,but while running on solaris and linux mouse right-click option window not poping up.
    2) Ctrl+c,Ctrl+v,Home and End keyboard key are not working in solaris and linux OS for same application.
    Pls provide me some solution for these problem.
    -Dinesh

    Hi Nik,
    Thanks for reply. I found some solution for the above problem.
    For mouse right click there was problem in my source code.I have not implemented the mousePressed() method
    In case of keyboard Home, End and arrow key working fine after exporting AWTUSE_TYPE4_PATCH=false; in solaris and linux
    But still Ctrl-c and Ctrl-v not working.
    I am using JDK1.5.0_07+Eclipse IDE 3.1
    -Dinesh

  • Vista and Solaris 10, are they compatible?

    I have attempted to follow dual boot guides found everywhere, but none tailor specifically to (or eve mention) Vista. This is a problem, because Vista does not use the same method of boot as previous versions of NT.
    So far, in my many failed attempts at creating a Vista dual boot, I have experienced this:
    When I install Solaris 10 on any partition (Solaris installs correctly and works great), and then attempt to install Windows Vista, Vista says all of my partitions do not meet its requirements for installation (that the drive is NTFS and at least 12 GB is all it tells me). Even after formatting, deleting, recreating, and reformatting a drive, the drive is still unusable. Only after deleting ALL drives, including Solaris 10, and recreating and brand new first partition does Vista allow me to install. If I create a partition that Vista allows me to use, and also a partition to use with Solaris, and THEN install Solaris, the partition that Vista liked can no longer be used!
    When I install Windows Vista first (and it works fine) (which is what I tried first and reasoned is what I should be doing), and then install Solaris 10 on a partition (it installs correctlt and works great), I load up my computer and go into the GRUB bootloader. I can select Windows. However, when attempting to load windows, I get an error (in the Vista font by the way) that says my operating system cannot be loaded. When I load my Vista install disc, it cannot find any installations of windows, and it cannot repair the master boot record, saying something like the filesystem is corrupt. However, just as an experiment, I loaded Vista onto the former Solaris drive, and looked at my first partition. Every file was there, intact.
    I have attempted this with Windows Home Premium 32 bit, Windows Business 32 bit, and Vista Ultimate x64. I don't want to believe that it's impossible to load Vista and Solaris simultaneously, I've seen as much stating its impossibility as I've seen documents telling me how to do it (<- cold irony).
    As long as I can get AN INSTALLATION of Solaris 10 on my machine at the same time I have Vista able to boot, I'm fine, but I seem to have lost on all fronts.
    Edited by: ZetaZeta on Sep 19, 2007 12:30 AM

    In Solaris Express, this is not an issue, according to this weblog:
    http://blogs.sun.com/moinakg/entry/solaris_vista_dual_boot_conclusion
    For versions of Solaris Express prior to buid 70, this method was described for creating a dual-boot with the oh-too-picky Windows Vista:
    http://linux.wordpress.com/2007/02/17/vista-and-solaris-express-dual-boot/
    I am going to assume that setting up a dual-boot with Solaris 10 is similar to, if not the same as, Solaris Express, since the only steps specific to Solaris are the files I copy from Solaris.
    I hope this helps anyone else with a problem similar to mine.

  • Windows Vista and  Solaris...10...install failed...help.

    Hi everyone!!
    i installed Solaris OS twice on my system
    i have vista previously on this...
    i made a partition for sol...
    after installation solaris boots fine
    but windows is totally corrupted and doestn boot normally
    ill have to erase the whole computers HD and then reinstall it again
    both the OSs are not working at the same time
    with solaris already installed if i try to repair or re install windows vista its erasing solaris partition totally
    please help!!! what should i do to get my system running with both OS s.
    any replies.....much awaited
    thank u so much in advance....
    -sriya
    Message was edited by:
    Sriya
    i have dell inspiron...just delivered yday...640m
    Message was edited by:
    Sriya

    Install Windows first, then Solaris {not the other way round}. When Solaris installer detects Windows installation and prompts you whether to preserve Windows partition, make sure to select 'preserve' option. I believe Solaris installer creates appropriate GRUB entries for Windows and Solaris. Even if it doesn't, you can always edit the GRUB menu after the installation is complete.
    Check the following web site if you need detailed instructions:
    http://multiboot.solaris-x86.org/index.html

  • Installing 11i on Solaris and migrating 8.0.5 to new 8.1.6 database

    I've installed 11i (several times) on a new Sun solaris server. I also selected it to install a fresh database. On another server we have 11.0 and 8.0.5 database. We are using a new server to install 11i and we want to move our database over. I managed to transfer all database files over to the new server and upgrade to 8.1.6 (succeeded)
    How do I proceed now to get the 11i applications to use the database i've transferred over. Is this possible??? Can't find any clear documentation on how to merge this database into the applications 11i.
    Thanks
    null

    Gina, I am attempting something similar... but it involves moving an exisiting installation from HP-UX to Solaris, so I cannot move the datafiles... If I run into a method that helps both of us, I will let you know... as of now, I am installing fresh on Solaris and going to try to run upgrade scripts on existing 10.7 and exp/imp into the new instance on 11i (Solaris).
    Let me know of anything you find out that could help me, and I will do the same...
    thanks
    dns

  • How do I install dual-boot Solaris 8 and Solaris 9 on one hard disk ?

    I tried to install Solaris 8 and Solaris 9 on same disk using CDs, but
    the second installation overwrote the first Solaris which was installed
    previoudly on the half-disk size partition of same disk.
    How do I install two Solarises on one hard disk ?
    Thanks
    Yakov

    There are no tricks to get Solaris to dual boot on the same drive. Just allocate and pick the free slices not used by the first Solaris install when you put in the second install. Technically speaking there is nothing preventing you from running seven separately bootable Solaris instances on the same drive (one of 8 available slices is overlap -- slice 2) provided you use a swap file on a root partition instead of reserving a whole slice for swap.

  • Dual boot windows 7 and solaris 11

    Hi Friends,
    Could some one please explain the steps to install dual boot windows 7 and solaris 11?
    Thanks
    Raja

    Install Windows leaving a partition for Solaris.  Install Solaris into the empty partition.  Reboot.  Use a partition manager if you need to shrink your current Windows Partition.  GParted works great and is free.
    alan

  • Dual Boot Windows 7 and solaris 10

    Can some body guide me how to dual boot windows 7 and solaris 10?
    Thanks

    First partition your harddisk with at least 2 primary partitions, one for windows and the other for solaris if you only have one harddisk. It would be a good idea to create an additional small boot partition as the first partition as well if you intend on using an independent boot loader but it really depends on what your machine is capable of. For example, if you have multiple harddisk and your BIOS supports it, then you could just install each OS onto its own harddisk and use the BIOS function to disable/boot off specific harddisk. Otherwise, if you only have one harddisk and created multiple partitions, install windows7 first followed by solaris10, obviously installing into different partitions. If you have created a boot partition, then you can install the boot loader into that dedicated partition.

  • Dual Booting Windows and Solaris

    Hi
    how do i dual boot windows and solaris
    Do i install windows first and then solaris or do it the other way around..?
    how do i make sure that Windows and Solaris appear in my boot options..?
    Is their a guide on doing this...?
    Thanks
    Liam

    Hey I did a quick google search for you. So I havent tried this method myself but it sounds reasonable.
    The text below is from the following link:
    http://www.hccfl.edu/pollock/AUnix1/DualBoot.htm
    "Solaris boot loader
    Partition the drive to leave at least 2GB of space available for Solaris;
    more drive space is desirable.
    As with Linux, install Windows first then Solaris.
    Do not use the Installation CD but boot and install
    from Software CD 1.
    If you accept the default partitioning scheme which
    the installer provides you will soon run out of space in
    your / and /usr partitions since only enough space is
    allocated to install the system.
    All extra space is allocated to /export/home.
    A typical installation on a 4.5GB partition might look
    something like this:
    Filesystem Size Used Avail Use% Mounted on
    /dev/dsk/c0d0s0 900M 536M 310M 64% /
    /dev/dsk/c0d0s1 334M 109M 192M 36% /var
    swap 671M 8.0k 671M 1% /var/run
    swap 671M 8.0k 671M 1% /tmp
    /dev/dsk/c0d0s5 845M 222M 565M 29% /opt
    # (FAT32 partition):
    /dev/dsk/c0d0p0:1 5.0G 3.3G 1.6G 66% /c
    /dev/dsk/c0d0s7 1.1G 92M 954M 9% /export/home
    /dev/dsk/c0d0s4 752M 225M 474M 33% /usr/local
    The Solaris boot selector enables you to choose either
    Solaris or Windows with Solaris as the default.
    (I prefer grub or lilo!)
    To mount FAT under Solaris:
    # mount -F pcfs /dev/dsk/c0d0p0:c /dos (or �:1�?)
    And the vfstab file:
    /dev/dsk/c0d0p0:c - /dos pcfs - yes -
    To create a GRUB boot floppy, follow these steps:
    $ mkfs -t ext2 /dev/fd0
    $ mount /dev/fd0 /mnt/fd0
    $ mkdir /mnt/fd0/boot /mnt/fd0/boot/grub
    $ cp /boot/grub/stage[12] /boot/grub/grub.conf \
    > /mnt/fd0/boot/grub
    $ /sbin/grub --batch <
    Hope this helps!
    /Oscar

  • Dimension 2300 and Solaris 10

    Hi guys....
    I just installed Solaris 10 (Dec 8, 2004) on a Dell Dimension 2300 and it doesn't seem that I can start the graphics interface. Right now it's sitting at level 3 (text only) and I'd love more than anything to bring it to level 5.
    I'm brand new to Solaris and dont know yet where to go get patches and/or drivers to support the monitor and graphics card... can someone help?
    The video card for this machine is Intel 845. I did run the xorgconfig tool (according to another thread in this forum) and changed the video card to Intel 810 (They dont have 845 in the list). Still not able to start the xserver.
    Will keep looking while waiting for an answer... Thanks all! Have a nice day...
    Kevin

    Seems like you're used to Linux. In Solaris run-level 5 is shutdown+poweroff.
    Try to configure the graphics adapter by using the "kdmconfig" command. Choose "Xsun" and pick the following driver:
    XF86-I830 Intel integrated graphics chipsets: 830, 845, 852, 855, 86
    After you're finished with kdmconfig start X-Windows using the following command:
    /etc/init.d/dtlogin start
    Regards,
    Martin Andersson

  • Compiler directives to differetiate between solaris 9 and solaris 10

    i have an API which makes certain function calls which are different for solaris 9 and solaris 10. i cannot add my own defines, since that would mean that applications too would have to define them.
    does the Sun Workshop compiler provide any default directives to differentiate between solaris 9 and solaris 10? something like #ifdef __SunOS_5.10 or something like that?
    thanks.

    As explained in the C Users Guide, the compiler predefines several macros, one of which is represents the Solaris version number.
    The macro name is derived from the output of the commands
    uname -s and uname -r, starting with __, connected by _, and with dots replaced by _.
    Running on Solaris 9:
    % uname -s
    SunOS
    % uname -r
    5.9
    The defined macro name is __SunOS_5_9
    On Solaris 10 you get __SunOS_5_10
    __SunOS_5_9

  • SSH Differences between Solaris 9 and Solaris 10

    I use public key authentication when connecting via SSH but have noticed a difference between Solaris 9 and Solaris 10 and wondered if it's an environment setup issue. I keep my keys in $HOME/.ssh
    When connecting from Solaris 9 I can provide an identity file without a path regardless of the directory that I'm in e.g.
    ssh -i my_identity_file user@hostnameThe above works even if I'm not in the $HOME/.ssh directory. But when using the same from Solaris 10 I get the following error:
    Warning: Identity file my_identity_file does not exist.If I run the command from $HOME/.ssh on Solaris 10 it connects fine, and if I pass in the path like so it works fine:
    ssh -i $HOME/.ssh/my_identity_file user@hostnameIs there a setting specific to SSH somewhere as I can't see anything in my environment that's different between the two systems. There's certainly no entry in $PATH that points to $HOME/.ssh. How could I get SSH to work on Solaris 10 by just providing the identity file name and not the full path
    Regards
    Rich

    It's not explicitly defined in /etc/ssh/ssh_config, so I'm assuming it would be using the default which is ~/.ssh/id_dsa.
    But surely that's irrelevant if I'm using the -i switch to provide the identity file?
    Remember the problem here is that I have to provide a full path to the identity file, whereas before just the filename would do.
    Rich

  • Differences between Linux and Solaris command set

    Hi,
    It is complicated to learn Solaris? Is the set of commands the same of Linux?
    It is because is more simple for me to find a Linux Admin book than a Solaris book.
    Thanks.
    Lorenzo

    BTW: You might want to start with this peace if information:
    http://wwws.sun.com/software/whitepapers/linux/linux_overview.pdf
    One remark: this Blue/white paper is written for audience known to Solaris and new to Linux, but usefull the other way around.
    Specially table 1 is very usefull !
    Good luck, and Welcome as new Solaris Administrator.
    Eric.

Maybe you are looking for

  • Unable to install itunes 11.1 Windows Vista

    Downloads then when tries to install.....ERROR. I have tried downloading directly from web but it has been sitting gathering required information performing installation tasks window for over an hour. I have disabled Norton....rebooted....nothing all

  • Need help exporting from lightroom 4 on my Macbook Air with an external hard drive.

    After importing photos to my new Macbook Air (2014) from external drive, it made me reformat my external drive.  After reformatting, I tried to export edited images back to my external drive and it says "photos missing or offline", even when external

  • Scanner for documents and books

    I'm looking for a versatile scanner to use primarily for documents and books (not photos or film). If I were only looking for a document scanner, I'd be checking out the Fujuita ScanSnap iX500. It's pricy, but it has rave reviews. Unfortunately, I al

  • How to find disk error.

    How to find disk error, i tried iostat -En , /var/adm/messages,and prtdiag -v . is there anyother way to find the hardware error.

  • Color settings and printing

    I have created a custom monitor profile and use this to optimise the results from my printer. If I am sending my photos else where to print or emailing them, should I use this profile or the default sRGB profile or is the AdobeRBG even better. Thanks