Sponsored Content
Top Forums Programming Linux System C headers puzzling Post 302390106 by JackCrital2005 on Wednesday 27th of January 2010 01:40:08 AM
Old 01-27-2010
Java Linux System C headers puzzling

I am new to Linux system programming, and I found the sophisiticated definition of some library function differ a lot with what I learnt in classes.

Here is the question:
what does the suffix of function `chmod' in sys/stat.h mean. The funtion claimation is like following:
Code:
    extern int chmod (__const char *__file, __mode_t __mode)
     __THROW __nonnull ((1));

According to my broken programming knowledge, suffix like "__THROW __nonnull ((1))" appear only in the C++, and they are generally used to handle the throwing of exceptions inside the functions.

I am glad anybody who is willing to share his/her idea. Thanks a lot.

Last edited by pludi; 01-27-2010 at 02:59 AM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

System Headers Path?

Is there an environment variable or other mechanism whereby I can get the system headers path? Preferrably I would like to be able to gather this information independant of the flavor of Unix. Thanks, Scott. (1 Reply)
Discussion started by: scottr
1 Replies

2. Shell Programming and Scripting

AWk is still puzzling me...

Hi all. Here's what i want to do: my_first_file #!/usr/bin/ksh # BLA BLA BLA BLA printf "this is my first file \n" echo " I understand this far" printf "the day's over \n" echo "great" my_second_file #!/usr/bin/ksh # BLA BLA BLA BLA printf "this is my first file \n" AN_INSERTED_LINE... (2 Replies)
Discussion started by: penguin-friend
2 Replies

3. Shell Programming and Scripting

puzzling regexp

hey guys, i'm having some problems with my understanding of this whole regexp thing. I'm just exploring here really by trying to do various match & filter & print stuff on the console. I figured i want to get the IP of an interface. So my idea here was that first i filter to extract only... (4 Replies)
Discussion started by: jad
4 Replies

4. Shell Programming and Scripting

Remove text between headers while leaving headers intact

Hi, I'm trying to strip all lines between two headers in a file: ### BEGIN ### Text to remove, contains all kinds of characters ... Antispyware-Downloadserver.com (Germany)=http://www.antispyware-downloadserver.c om/updates/ Antispyware-Downloadserver.com #2... (3 Replies)
Discussion started by: Trones
3 Replies

5. Shell Programming and Scripting

Syntax error, puzzling

I am just learning over here unix scripting and the OS in general. I wrote this script (with some great help from you guys here) when I test at my desktop with cygwin it works fine, but when I take it to work and try it on the Solaris 2 system there I get an error on line 4 syntax error... (4 Replies)
Discussion started by: Fred Goldman
4 Replies

6. IP Networking

Puzzling Traceroute output

This is the output that I get every so often when trying to do a traceroute to the web server whenever it's inaccessible: traceroute to 64.40.98.181 (64.40.98.181), 30 hops max, 40 byte packets 1 207.97.207.194 (207.97.207.194) 2.625 ms 2.840 ms 2.968 ms 2 core1-5.iad1.rackspace.com... (6 Replies)
Discussion started by: gaspol
6 Replies

7. Shell Programming and Scripting

Merging of files with different headers to make combined headers file

Hi , I have a typical situation. I have 4 files and with different headers (number of headers is varible ). I need to make such a merged file which will have headers combined from all files (comman coluns should appear once only). For example - File 1 H1|H2|H3|H4 11|12|13|14 21|22|23|23... (1 Reply)
Discussion started by: marut_ashu
1 Replies

8. UNIX for Dummies Questions & Answers

Puzzling permission issue

I have a file, the long listing output by 'ls -l' is -rw-r--r-- 1 usera agroup 1246 Jul 7 14:44 temp.R The file is under a Solaris ZFS file system. As a different user (userb), I did cp temp.R /tmp ls -l /tmp/temp.R -rw-r--r-- 1 userb agroup 1246 Nov 16 14:45 /tmp/temp.R ... (14 Replies)
Discussion started by: nugulus
14 Replies

9. UNIX for Dummies Questions & Answers

Append file name to fasta file headers in Linux

How do we append the file name to fasta file headers in multiple fasta-files in Linux? (10 Replies)
Discussion started by: Mauve
10 Replies

10. Windows & DOS: Issues & Discussions

Sys headers - running Linux C code on windows

Hi All, I wanted to run a small socket application written in C on windows. The code was written for GNU/linux..the compiler on windows CodeBlocks complains about the sys headers. is there an equivalent for windows ? (4 Replies)
Discussion started by: coolatt
4 Replies
GETGRENT(3)						     Library Functions Manual						       GETGRENT(3)

NAME
getgrent, getgrgid, getgrnam, setgrent, endgrent - get group file entry SYNOPSIS
#include <grp.h> struct group *getgrent() struct group *getgrgid(gid) int gid; struct group *getgrnam(name) char *name; setgrent() endgrent() DESCRIPTION
Getgrent, getgrgid and getgrnam each return pointers to an object with the following structure containing the broken-out fields of a line in the group file. /* Copyright (C) 1991-2018 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* * POSIX Standard: 9.2.1 Group Database Access <grp.h> */ #ifndef _GRP_H #define _GRP_H 1 #include <features.h> __BEGIN_DECLS #include <bits/types.h> #define __need_size_t #include <stddef.h> /* For the Single Unix specification we must define this type here. */ #if (defined __USE_XOPEN || defined __USE_XOPEN2K) && !defined __gid_t_defined typedef __gid_t gid_t; # define __gid_t_defined #endif /* The group structure. */ struct group { char *gr_name; /* Group name. */ char *gr_passwd; /* Password. */ __gid_t gr_gid; /* Group ID. */ char **gr_mem; /* Member list. */ }; #ifdef __USE_MISC # include <bits/types/FILE.h> #endif #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED /* Rewind the group-file stream. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void setgrent (void); /* Close the group-file stream. This function is a possible cancellation point and therefore not marked with __THROW. */ extern void endgrent (void); /* Read an entry from the group-file stream, opening it if necessary. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct group *getgrent (void); #endif #ifdef __USE_MISC /* Read a group entry from STREAM. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern struct group *fgetgrent (FILE *__stream); #endif #ifdef __USE_GNU /* Write the given entry onto the given stream. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int putgrent (const struct group *__restrict __p, FILE *__restrict __f); #endif /* Search for an entry with a matching group ID. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct group *getgrgid (__gid_t __gid); /* Search for an entry with a matching group name. This function is a possible cancellation point and therefore not marked with __THROW. */ extern struct group *getgrnam (const char *__name); #ifdef __USE_POSIX # ifdef __USE_MISC /* Reasonable value for the buffer sized used in the reentrant functions below. But better use `sysconf'. */ # define NSS_BUFLEN_GROUP 1024 # endif /* Reentrant versions of some of the functions above. PLEASE NOTE: the `getgrent_r' function is not (yet) standardized. The interface may change in later versions of this library. But the interface is designed following the principals used for the other reentrant functions so the chances are good this is what the POSIX people would choose. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ # ifdef __USE_GNU extern int getgrent_r (struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result); # endif /* Search for an entry with a matching group ID. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int getgrgid_r (__gid_t __gid, struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result); /* Search for an entry with a matching group name. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int getgrnam_r (const char *__restrict __name, struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result); # ifdef __USE_MISC /* Read a group entry from STREAM. This function is not standardized an probably never will. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int fgetgrent_r (FILE *__restrict __stream, struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result); # endif #endif /* POSIX or reentrant */ #ifdef __USE_MISC # define __need_size_t # include <stddef.h> /* Set the group set for the current user to GROUPS (N of them). */ extern int setgroups (size_t __n, const __gid_t *__groups) __THROW; /* Store at most *NGROUPS members of the group set for USER into *GROUPS. Also include GROUP. The actual number of groups found is returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int getgrouplist (const char *__user, __gid_t __group, __gid_t *__groups, int *__ngroups); /* Initialize the group set for the current user by reading the group database and using all groups of which USER is a member. Also include GROUP. This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ extern int initgroups (const char *__user, __gid_t __group); #endif /* Use misc. */ __END_DECLS #endif /* grp.h */ The members of this structure are: gr_name The name of the group. gr_passwd The encrypted password of the group. gr_gid The numerical group-ID. gr_mem Null-terminated vector of pointers to the individual member names. Getgrent simply reads the next line while getgrgid and getgrnam search until a matching gid or name is found (or until EOF is encountered). Each routine picks up where the others leave off so successive calls may be used to search the entire file. A call to setgrent has the effect of rewinding the group file to allow repeated searches. Endgrent may be called to close the group file when processing is complete. FILES
/etc/group SEE ALSO
getlogin(3), getpwent(3), group(5) DIAGNOSTICS
A null pointer (0) is returned on EOF or error. BUGS
All information is contained in a static area so it must be copied if it is to be saved. 7th Edition May 15, 1985 GETGRENT(3)
All times are GMT -4. The time now is 11:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy