Sponsored Content
Full Discussion: No error but not executing
Top Forums Programming No error but not executing Post 302479565 by DGPickett on Saturday 11th of December 2010 01:05:24 PM
Old 12-11-2010
I never call write() but I error check right there, check amount written, and loop if EINTR, EAGAIN if O_NONBLOCK, too, all part of the joys of raw I/O:
Code:
char *write_point ;
int char_to_write ;
int ret ;

for ( char_to_write = strlen( starting_string ), write_point = starting_string ; char_to_write ; /* nothing */ ){
  if ( 0 > ( ret = write( fd, write_point, char_to_write )){
    if ( errno == EINTR )
      continue ;
     if ( errno = EAGAIN ){
       poll( 0, 0, 1 ); /* sleep a millisecond */
       continue ;
      }
     perror( "write error" );
     exit( 1 );
   }
  write_point += ret ;
  char_to_write -= ret ;
 }

This User Gave Thanks to DGPickett For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

error while executing the script

Hello I am executing the following script nawk 'NR == 1 || substr($0,63,5) ~ /H... / && \ _++ == 2 { fn && close(fn); fn = "part_" ++c; _ = 1 } { print > fn }' sample.dat When i execute as it is it is executing fine. but when i execute the whole script as a single line like below ... (2 Replies)
Discussion started by: dsdev_123
2 Replies

2. Shell Programming and Scripting

Error while executing a script

My script is as below : #!/bin/sh for line in `cat Results.txt` do FEILD1=`echo $line |awk -F"|" '{print $1}'` FEILD2=`echo $line |awk -F"|" '{print $2}'` FEILD3=`echo $line |awk -F"|" '{print $3}'` FEILD4=`echo $line |awk -F"|" '{print $4}'` echo "$FEILD1 $FIELD2 $FIELD3 $FIELD4" done ... (15 Replies)
Discussion started by: shwetainnani
15 Replies

3. UNIX for Dummies Questions & Answers

Error Executing the script.

Hi , I m getting an error after executing the script. My script. Script is used to find out the date on 8 different machines(mentioned in SERVERNAMES file). I have added public key to avoid ssh password and ssh without password working fine. #!/bin/sh fn_VMFind() { Date=`ssh -t... (5 Replies)
Discussion started by: pinga123
5 Replies

4. Programming

No error but not executing

Hi friends NO errors, but when I try to execute the program it gets struck. Can any one find it out. #include<stdio.h> #include<sys/types.h> #include<sys/mman.h> #include<stdlib.h> #include<fcntl.h> #include<sys/stat.h> #include<unistd.h> #include<signal.h> #include<string.h> ... (0 Replies)
Discussion started by: gokult
0 Replies

5. Shell Programming and Scripting

Error executing script

Please delete de thread. Thanks. (10 Replies)
Discussion started by: Rodrih92
10 Replies

6. Shell Programming and Scripting

Error while executing sh command

Hi, I have 2 files temp1.sh and temp2.sh as follows: =========== temp1.sh =========== echo "session1" sh temp2.sh echo "exit session2 and enter session1" ================================= ============= temp2.sh ============= echo "session2" sh echo "exit session2"... (5 Replies)
Discussion started by: RP09
5 Replies

7. Linux

Error executing a variable

greetings, i'll try to keep this simple... i have a script that sets up my environment and creates a command line variable to execute. when i execute the variable i get an error telling me it cannot open one of the files on the command line. the error prints a file name that is definitely... (7 Replies)
Discussion started by: crimso
7 Replies

8. UNIX for Dummies Questions & Answers

Error executing the script

I have the following script test.sh owned by dwdev account and group dwdev, the permissions on the script are as follows. -rw-r-x--- 1 dwdev dwdev 279 Sep 17 13:19 test.sh Groups: cat /etc/group | grep dwdev dwdev:x:704:dwdev dwgroup:x:725:dwdev writers:x:726:dwdev User: cat /etc/passwd |... (3 Replies)
Discussion started by: Ariean
3 Replies

9. Programming

Error in executing the C program

Hello Friends, I have written a code for the unisex bathroom which makes a policy that when a woman is in the bathroom only other women may enter, but not men, and vice versa. This program consists of four functions which a user defines but these functions are not properly working while... (4 Replies)
Discussion started by: Ravi Tej
4 Replies

10. Red Hat

Error when executing script

Hi, I wrote this script to test if the output for DIR1 and DIR2 comes out as I want : #!/bin/bash DAY=$(date +%d) MONTH=$(date +%b) YEAR=$(date +%Y) DIR1=$($MONTH$YEAR"_Blast_BC01") DIR2=$($MONTH$YEAR"_Blast_BC15") echo $DIR1 echo $DIR2 This is the output I want for echo $DIR1 ... (12 Replies)
Discussion started by: anaigini45
12 Replies
PAPI_get_thr_specific(3)					       PAPI						  PAPI_get_thr_specific(3)

NAME
PAPI_get_thr_specific - Retrieve a pointer to a thread specific data structure. SYNOPSIS
Detailed Description @par Prototype: int PAPI_get_thr_specific( int tag, void **ptr ); @param tag An identifier, the value of which is either PAPI_USR1_TLS or PAPI_USR2_TLS. This identifier indicates which of several data structures associated with this thread is to be accessed. @param ptr A pointer to the memory containing the data structure. @retval PAPI_OK @retval PAPI_EINVAL The @em tag argument is out of range. In C, PAPI_get_thr_specific PAPI_get_thr_specific will retrieve the pointer from the array with index @em tag. There are 2 user available locations and @em tag can be either PAPI_USR1_TLS or PAPI_USR2_TLS. The array mentioned above is managed by PAPI and allocated to each thread which has called PAPI_thread_init. There is no Fortran equivalent function. @par Example: int ret; HighLevelInfo *state = NULL; ret = PAPI_thread_init(pthread_self); if (ret != PAPI_OK) handle_error(ret); // Do we have the thread specific data setup yet? ret = PAPI_get_thr_specific(PAPI_USR1_TLS, (void *) &state); if (ret != PAPI_OK || state == NULL) { state = (HighLevelInfo *) malloc(sizeof(HighLevelInfo)); if (state == NULL) return (PAPI_ESYS); memset(state, 0, sizeof(HighLevelInfo)); state->EventSet = PAPI_NULL; ret = PAPI_create_eventset(&state->EventSet); if (ret != PAPI_OK) return (PAPI_ESYS); ret = PAPI_set_thr_specific(PAPI_USR1_TLS, state); if (ret != PAPI_OK) return (ret); } * See Also: PAPI_register_thread PAPI_thread_init PAPI_thread_id PAPI_set_thr_specific Author Generated automatically by Doxygen for PAPI from the source code. Version 5.2.0.0 Tue Jun 17 2014 PAPI_get_thr_specific(3)
All times are GMT -4. The time now is 04:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy