Sponsored Content
Top Forums Programming AIX calling WINSOCK during e-mail - normal? Post 302490805 by Corona688 on Tuesday 25th of January 2011 05:26:02 PM
Old 01-25-2011
Try fprintf(stdout,...) instead of stderr. We really need to know.
This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. AIX

Calling All Aix Experts

I am new to the world of AIX. I want to get certified in AIX and learn it but fast. with in 3 months Could you give me some advise of a good site that with teach you or a bootcamp that is reasonable. I am really in need I am in atlanta (0 Replies)
Discussion started by: Courtney3216
0 Replies

2. AIX

To find RAM Size in AIX as normal user?

Hi, Am jus trying to find the Total RAM Size of a AIX m/c (in MB)..svmon works perfectly for a superuser...But i want to achive this as a normal user...Please help me out with correct command.. Best Regards, Muthukumaran.M (3 Replies)
Discussion started by: muthukumaran13
3 Replies

3. AIX

Normal User Unable to Login Through AIX CDE

When we as normal user try to login, the session startup terminates and we are presented with the login screen.The root user is able to login without any problem.I can log in to the Aix server as normal user through telnet & using xmanager but not directly through server terminal .The Aix version... (1 Reply)
Discussion started by: ranadeep
1 Replies

4. UNIX for Dummies Questions & Answers

Forwarding Mail in AIX 5.3

Hello everyone, I am trying to create a forwarding scenario, and I do not seem to get it right! I created a .forward file in the directory where my personal mailbox resides. In the file is the full address to deliver email to ... yet the emails do not seem to get forwarded. Is there something... (3 Replies)
Discussion started by: gio001
3 Replies

5. UNIX for Advanced & Expert Users

Oracle (11gr2) calling unix commands (aix)

I have an Oracle database running on AIX, and I have a procedure that is calling OS commands from an oracle (and it's not working anymore)... so, there was an Java stored proc in Oracle CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED COMMON."Host" as import java.io.*; public class Host {... (1 Reply)
Discussion started by: bongo
1 Replies

6. Shell Programming and Scripting

Calling SQL script from ksh job and send mail on some error.

Hi, I am trying to call sql script from ksh job with parameters.The parameters passed from ksh job will be used in SELECT query in sql file to SPOOL the data in extract file.My questions are: 1) How to call a sql script from ksh job with parameters? 2) How to use the parameter in sql file to... (1 Reply)
Discussion started by: anil029
1 Replies

7. Shell Programming and Scripting

AIX mail notification

plzzz help me, I want to send emails for exchange group members when the used file-system % gets more than 90%, this notification must include df -g, netstat -i,and errpt with the hostname thx in advance (0 Replies)
Discussion started by: majd_ece
0 Replies

8. Shell Programming and Scripting

Send mail from AIX 7.1

Hi, My OS version is AIX 7.1. I am trying to send an email with a file to my mail address. sendmail or uuencode does not work. Can someone give me the correct format ? I use: uuencode <file name> | mail -s "subject" emailaddress Thanks Use code tags, thanks. (3 Replies)
Discussion started by: Nagesh_1985
3 Replies

9. Shell Programming and Scripting

AIX : Need to convert UNIX Timestamp to normal timestamp

Hello , I am working on AIX. I have to convert Unix timestamp to normal timestamp. Below is the file. The Unix timestamp will always be preceded by EFFECTIVE_TIME as first field as shown and there could be multiple EFFECTIVE_TIME in the file : 3.txt Contents of... (6 Replies)
Discussion started by: rahul2662
6 Replies

10. AIX

Unable to set ACLs on sulog - need to grant read permission to a normal user on AIX 6.1

Hi, I need to grant read permission to a normal user on sulog file on AIX 6.1. As root I did acledit sulog and aclget shows "extended permissions" as "enabled" and normal user "splunk" has read permissions. When I try to access sulog as splunk user it won't allow and aclget for splunk user... (6 Replies)
Discussion started by: prvnrk
6 Replies
CGLOBALS(3)						     Common Library Functions						       CGLOBALS(3)

NAME
Cglobals - LCG thread-specific global variables interface SYNOPSIS
#include <Cglobals.h> void Cglobals_init( int (*getspec) (int *key, void **addr), int (*setspec) (int *key, void *addr), int (*getTid) (void) ); int Cglobals_get(int *key, void **addr, size_t size); void Cglobals_getTid(int *Tid); int C__serrno(); int C__rfio_errno(); int C__Copterr(); int C__Coptind(); int C__Coptopt(); int C__Coptreset(); char *C__Coptarg(); int C__h_errno(); DESCRIPTION
Cglobals is the interface where are defined all necessary functions that always return a thread-specific value of global variables. Each package of LCG that needs to externalize thread-specific global variables contains in its header, if compiled with threads turned on (e.g. the default), a set of: an extern definition to a function contained in Cglobals a #define macro that replaces all occurences of any global variable that needs to be thread-specific to this Cglobal's function. In order to satisfy packages not compiled with threads turned on, or that do not initialize LCG Thread Interface's Cthread, any such global variable is also explicitly defined in Cglobals. For example, taking the global error variable serrno, Cglobals source code contains: an explicit definition of this variable serrno an explicit definition, with source code, of a function C_serrno() that does only the following: if Cglobals_init was not (successfully) called, return the address of the global variable serrno else return the address of a thread-safe specific memory, instanciated at the first call to this function, that holds the content of the current instance of the thread-specific value of serrno The following description of Cglobals_init function is explaining internals of Cglobals and Cthread. In theory no LCG application need to call Cglobals_init, you can skip if you want the following paragraphs, and concentrate only on the other functions descriptions. Cglobals_init is bundled to work with the LCG Thread Interface's Cthread. That is, any implicit or explicit call to Cthread always makes sure that Cglobals_init is called, with three arguments that are: a getspec function address that, given a static key address, returns the address of a Thread-Specific memory into addr content. This uses an internal structure inside Cthread, allocated on the heap, that is associated bijectively to key address. Cthread always explicitly allocates such internal structure to any key address if it is unknown at the moment of the call to getspec. In such a case it will return a NULL value into addr , and it will be the responsability of Cglobals to allocate memory on the heap and to say to Cthread that this newly allocated memory is the one to associate with key address, using setspec. If the internal structure in Cthread associated bijectively to key yet exists, getspec only returns what it knows about the thread- specific memory associated with it, which is a void * member inside the same internal structure mentionned above. a setspec function address that, given the key address and the addr value, previously instanciated with a getspec call, and possibly allocated on the heap by Cglobals if necessary, will internally explicitly call the Operating System Thread-Specific functions that will put the value of address as something thread-specific, bijectively associated to another member of the internal structure of Cthread, itself bijective to key. a getTid function address that returns an unique integer identifier associated with any thread. Cglobals_get returns in addr content the address of a thread-specific memory, e.g. thread-safe, that is bijectively associated with the address of a *static*, e.g. constant, address key , that is automatically created and filled with zeros if necessary, up to size bytes. If the addr content, at return of Cglobals_get, is not NULL, you can safely fill this memory with any value, provided you does not exceed the size bytes length specified in your previous call to Cglobals_get. Because of applications that are not multi-threaded, the initial value of key has then an importance, that's why it is necessary to always declare it with an initial value of -1. Return code is -1 on error, 0 on success and not the first call for this key , 1 on success and it is the first call for this key. This allows to distinguish when Cglobals_get() initialize the memory with zeros (return code 1) and not (return code 0). Cglobals_getTid uses the third function address, getTid , given as an argument to Cglobals_init, and will return in Tid content the value returned by getTid. C__serrno, C__rfio_errno, C__Copterr, C__Coptind, C__Coptopt, C__Coptreset, C__Coptarg and C__h_errno are all the internal functions that return the address of the thread-specific memory hosting the value of the 'global' variables serrno, rfio_errno, Copterr, Coptind, Coptopt, Coptreset, Coptarg and h_errno, respectively. EXAMPLE
Any application can create its own instance of thread-specific global variable using Cglobals. You need only to use Cglobals_get. Here is how to proceed. /* * The following shows how to define and use a thread-specific * integer, my_var, inside your package */ #include <stdlib.h> #include <stdio.h> #include <Cglobals.h> /* Get Cglobals_get prototype */ static int my_key = -1; /* Our static key, integer, init value -1 */ #define my_var (*C__my_var()) static int my_var_static; /* If Cglobals_get error in order not to crash */ int *C__my_var() { int *var; /* Call Cglobals_get */ Cglobals_get(&my_key, (void **) &var, sizeof(int) ); /* If error, var will be NULL */ if (var == NULL) { fprintf(stderr,"Cglobals_get error0); return(&my_var_static); } return(var); } int main() { fprintf(stdout, "Current my_var value is: %d0, my_var); fprintf(stdout, "Set my_var value to: %d0, 12); my_var = 12; fprintf(stdout, "Current my_var value is: %d0, my_var); return(0); } The following example is the source of the test suite for Cglobals_get(): #include <Cthread_api.h> #include <stdlib.h> #include <stdio.h> #include <Cglobals.h> /* Get Cglobals_get prototype */ #include <serrno.h> static int my_key = -1; /* Our static key, integer, init value -1 */ #define my_var (*C__my_var()) static int my_var_static; /* If Cglobals_get error in order not to crash */ void *doit _PROTO((void *)); int doit_v = 0; #define NTHREAD 100 int *C__my_var() { int *var; /* Call Cglobals_get */ switch (Cglobals_get(&my_key, (void **) &var, sizeof(int) )) { case -1: fprintf(stderr,"[%d] Cglobals_get error0, Cthread_self()); break; case 0: fprintf(stderr,"[%d] Cglobals_get OK0, Cthread_self()); break; case 1: fprintf(stderr,"[%d] Cglobals_get OK and first call0, Cthread_self()); break; default: fprintf(stderr,"[%d] Cglobals_get unknown return code0, Cthread_self()); break; } /* If error, var will be NULL */ if (var == NULL) { fprintf(stderr,"[%d] Cglobals_get error : RETURN static ADDRESS!!!!!!!!!!!!0, Cthread_self()); return(&my_var_static); } return(var); } int main() { int i; fprintf(stdout, "[%d] ---> Before any Cthread call0, -1); fprintf(stdout, "[%d] Current my_var value is: %d0, -1, my_var); fprintf(stdout, "[%d] Set my_var value to: %d0, -1, 12); my_var = 12; fprintf(stdout, "[%d] Current my_var value is: %d0, -1, my_var); fprintf(stdout, "[%d] Testing consistency0, -1); if (my_var != 12) { fprintf(stdout, "[%d] Cglobals_get worked ok0, -1); exit(1); } sleep(1); for (i = 0; i < NTHREAD; i++) { Cthread_create(&doit, &doit_v); doit_v++; } fprintf(stdout, "[%d] ---> After all Cthread_create calls0, -1); fprintf(stdout, "[%d] Current my_var value is: %d0, -1, my_var); fprintf(stdout, "[%d] Set my_var value to: %d0, -1, NTHREAD * 10000 + 12); my_var = NTHREAD * 10000 + 12; fprintf(stdout, "[%d] Current my_var value is: %d0, -1, my_var); fprintf(stdout, "[%d] Testing consistency0, -1); if (my_var != (NTHREAD * 10000 + 12)) { fprintf(stdout, "[%d] Cglobals_get worked ok0, -1); exit(1); } sleep(1); exit(0); } void *doit(arg) void *arg; { int Tid; int doit = * (int *) arg; Cglobals_getTid(&Tid); my_var = (Tid + 1) * 100 + 12; fprintf(stdout, "[%d] my_var value is: %d (should be %d)0, Cthread_self(), my_var, (Tid + 1) * 100 + 12); fprintf(stdout, "[%d] second call -- my_var value is: %d (should be %d)0, Cthread_self(), my_var, (Tid + 1) * 100 + 12); fprintf(stdout, "[%d] Testing consistency0, Cthread_self()); if (my_var != ((Tid + 1) * 100 + 12)) { fprintf(stdout, "[%d] !!!!!!!!! ERROR !!!!!!!!!0, Cthread_self()); exit(1); } else { fprintf(stdout, "[%d] Cglobals_get worked ok0, Cthread_self()); } return(0); } SEE ALSO
Cthread(3), serrno(3), Cgetopt(3) AUTHOR
LCG Grid Deployment Team LCG
$Date: 2010-04-05 09:51:26 +0200 (Mon, 05 Apr 2010) $ CGLOBALS(3)
All times are GMT -4. The time now is 08:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy