How to use option of Selected SUSv3 options?


 
Thread Tools Search this Thread
Top Forums Programming How to use option of Selected SUSv3 options?
# 1  
Old 11-08-2012
How to use option of Selected SUSv3 options?

when we want to us options of SUSv3 options what is the syntax of it ?
# 2  
Old 11-08-2012
This is an EXAMPLE. You have to look up how your compiler exactly wants to see it.
Some compilers require numbers like 2004L in the define statement.

Since you already know that you need POSIX 3 or POSIX 2004 or whatever, go back to the documentation where you found that requirement. It will have examples.


Code:
#define _INCLUDE_POSIX_SOURCE
#define _INCLUDE_XOPEN_SOURCE
#define _INCLUDE_XOPEN_SOURCE_EXTENDED 1

# 3  
Old 11-09-2012
I think you got me wrong................. Ill give you what I wrote you tell me true or false

The Linux Programming Interface: A Linux and Unix System Programming Handbook - Michael Kerrisk - Google Books
page 221

I wrote:
Code:
sysconfPrint("_SC_SEMAPHORES", _SC_SEMAPHORES);

Code:
sysconfPrint(const char *msg, int name)
{
    long lim;

    errno = 0;
    lim = sysconf(name);
    if (lim != -1) {        /* Call succeeded, limit determinate */
        printf("%s %ld\n", msg, lim);
    } else {
        if (errno == 0)     /* Call succeeded, limit indeterminate */
            printf("%s (indeterminate)\n", msg);
        else                /* Call failed */
            errExit("sysconf %s", msg);
    }
}

# 4  
Old 11-09-2012
Here is what POSIX.1 says:
Code:
If name is an invalid value, sysconf() shall return -1 and set errno to indicate the error. 
If the variable corresponding to name is described in <limits.h> as a maximum or minimum
value and the variable has no limit, sysconf() shall return -1 without changing the value 
of errno. Note that indefinite limits do not imply infinite limits; see <limits.h>.

Otherwise, sysconf() shall return the current variable value on the system. The value 
returned shall not be more restrictive than the corresponding value described to the 
application when it was compiled with the implementation's <limits.h> or <unistd.h>. The 
value shall not change during the lifetime of the calling process, [XSI] [Option Start]  
except that sysconf(_SC_OPEN_MAX) may return different values before and after a call 
to setrlimit() which changes the RLIMIT_NOFILE soft limit. [Option End]

If the variable corresponding to name is dependent on an unsupported option, the results 
are unspecified.

and here is an example:
Code:
#include <stdio.h>
#include <unistd.h>
#include <errno.h>

main() {
  long result;

  errno = 0;
  puts("Checking NGROUPS_MAX limit");
  if ((result = sysconf(_SC_NGROUPS_MAX)) == -1)
    if (errno == 0)
      puts("NGROUPS_MAX is not supported.");
    else perror("sysconf() error");
  else
    printf("The maximum number of supplemental groups (NGROUPS_MAX) is %ld\n", result);
}


Last edited by fpmurphy; 11-09-2012 at 11:12 AM..
This User Gave Thanks to fpmurphy For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Solaris

Unrecognized option: sparc-sun-Solaris2.10/bin/as: unrecognized option `-m32'

Hi, I installed some packages required by an app built with python. But when I try python setup.py install, I get the following error: /opt/csw/lib/gcc/sparc-sun-solaris2.10/5.2.0/../../../../sparc-sun-solaris2.10/bin/as: unrecognized option `-m32' Could anyone tell me what's wrong... (4 Replies)
Discussion started by: Kimkun
4 Replies

2. Shell Programming and Scripting

How to print selected fields

HI, I am using below command to display the words, but i am getting awk error. Please help me out on this I am using below code i am getting error as If i use below code i am getting below OP Output from where i am trying to select the fields after delimiter "," from here i want to... (5 Replies)
Discussion started by: darling
5 Replies

3. Ubuntu

Kernel boot options removed by fault, no boot options

Hello Everyone, First of all, I highly appreciate all Linux forum members and whole Linux community. http://forums.linuxmint.com/images/smilies/icon_wink.gif. I wish you the best for all of you ! I will try to be short and concise: I am using Linux Mint 10 for 2 months on 2 ws, and all went... (3 Replies)
Discussion started by: cdt
3 Replies

4. Shell Programming and Scripting

recently introduced to the newer option for find...does an older option exist?

To find all the files in your home directory that have been edited in some way since the last tar file, use this command: find . -newer backup.tar.gz Is anyone familiar with an older solution? looking to identify files older then 15mins across several directories. thanks, manny (2 Replies)
Discussion started by: mr_manny
2 Replies

5. Shell Programming and Scripting

trying to print selected fields of selected lines by AWK

I am trying to print 1st, 2nd, 13th and 14th fields of a file of line numbers from 29 to 10029. I dont know how to put this in one code. Currently I am removing the selected lines by awk 'NR==29,NR==10029' File1 > File2 and then doing awk '{print $1, $2, $13, $14}' File2 > File3 Can... (3 Replies)
Discussion started by: ananyob
3 Replies

6. Shell Programming and Scripting

option followed by : taking next option if argument missing with getopts

Hi all, I am parsing command line options using getopts. The problem is that mandatory argument options following ":" is taking next option as argument if it is not followed by any argument. Below is the script: while getopts :hd:t:s:l:p:f: opt do case "$opt" in -h|-\?)... (2 Replies)
Discussion started by: gurukottur
2 Replies

7. Solaris

can not mount the selected partition

Dear Brothers First i installed suse linux with the following partition. my hd0 size is 75gb hdc1 swap 1 gb hdc2 native linux 39gb For the rest of the 35 gb i did not create any partition. so i planned to install solaris 10x86 on that free space. When i installed the solaris i... (1 Reply)
Discussion started by: sayed_021
1 Replies

8. Solaris

how to do selected copy

I need to copy the files from one dir to another dir based on sysdate, like cp -> (sysdate-n) filename -> to -> new dir n = 1,2,3.............. (3 Replies)
Discussion started by: dbasan
3 Replies
Login or Register to Ask a Question