Skip to content

Commit

Permalink
Fix name collisions and some further problems
Browse files Browse the repository at this point in the history
- F_LOCK is an integer constant, the original struct name is `struct flock`
- sleep is `uint sleep(uint)` not `void sleep(int)`
- ntFunction is really an "umbrella" typedef for several different function
  signatures, so just define it with ... now

Signed-off-by: Fyodor Kovin <[email protected]>
  • Loading branch information
fkovinAtRocket committed May 13, 2019
1 parent c79e5a7 commit 65c60f1
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 17 deletions.
9 changes: 5 additions & 4 deletions c/bpxskt.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,17 @@ int setSocketTrace(int toWhat) {
return was;
}

void sleep(int seconds){
int returnValue;
int *returnValuePtr;
unsigned int sleep(unsigned int seconds){
unsigned int returnValue;
unsigned int *returnValuePtr;

#ifndef _LP64
returnValuePtr = (int*) (0x80000000 | ((int)&returnValue));
returnValuePtr = (unsigned int*) (0x80000000 | ((int)&returnValue));
#else
returnValuePtr = &returnValue;
#endif
BPXSLP(seconds,returnValuePtr);
return returnValue;
}

void bpxSleep(int seconds)
Expand Down
3 changes: 2 additions & 1 deletion c/crossmemory.c
Original file line number Diff line number Diff line change
Expand Up @@ -3268,9 +3268,10 @@ static int handleModifyCommand(STCBase *base, CIB *cib, STCConsoleCommandType co
return 0;
}

static void sleep(int seconds){
static unsigned int sleep(unsigned int seconds){
int waitValue = seconds * 100;
__asm(" STIMER WAIT,BINTVL=%0\n" : : "m"(waitValue));
return 0;
}

static int isEnvironmentReady() {
Expand Down
3 changes: 2 additions & 1 deletion c/mtlskt.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@

static int socketTrace = 0;

void sleep(int seconds){
unsigned int sleep(unsigned int seconds){
int waitValue = seconds * 100;
__asm(" STIMER WAIT,BINTVL=%0\n" : : "m"(waitValue));
return 0;
}

void bpxSleep(int seconds)
Expand Down
12 changes: 6 additions & 6 deletions c/zosfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1642,14 +1642,14 @@ int fileSetLock(UnixFile *file, int *returnCode, int *reasonCode) {
#endif

int action = F_SET_LOCK;
F_LOCK flockdata;
BpxFLock flockdata;
flockdata.l_type = F_WRITE_LOCK;
flockdata.l_whence = F_SEEK_SET;
flockdata.l_start = 0;
flockdata.l_len = F_WHENCE_TO_END;
flockdata.l_pid = 0;

F_LOCK *fnctl_ptr = &flockdata;
BpxFLock *fnctl_ptr = &flockdata;

BPXFCT(&file->fd,
&action,
Expand Down Expand Up @@ -1677,14 +1677,14 @@ int fileGetLock(UnixFile *file, int *returnCode, int *reasonCode, int *isLocked)
#endif

int action = F_GET_LOCK;
F_LOCK flockdata;
BpxFLock flockdata;
flockdata.l_type = F_WRITE_LOCK;
flockdata.l_whence = F_SEEK_SET;
flockdata.l_start = 0;
flockdata.l_len = F_WHENCE_TO_END;
flockdata.l_pid = 0;

F_LOCK *fnctl_ptr = &flockdata;
BpxFLock *fnctl_ptr = &flockdata;

BPXFCT(&file->fd,
&action,
Expand Down Expand Up @@ -1716,14 +1716,14 @@ int fileUnlock(UnixFile *file, int *returnCode, int *reasonCode) {
#endif

int action = F_SET_LOCK;
F_LOCK flockdata;
BpxFLock flockdata;
flockdata.l_type = F_UNLOCK;
flockdata.l_whence = F_SEEK_SET;
flockdata.l_start = 0;
flockdata.l_len = F_WHENCE_TO_END;
flockdata.l_pid = 0;

F_LOCK *fnctl_ptr = &flockdata;
BpxFLock *fnctl_ptr = &flockdata;

BPXFCT(&file->fd,
&action,
Expand Down
2 changes: 1 addition & 1 deletion h/bpxnet.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ typedef struct hostent_tag{

/* sleep(int seconds) is standard in linux */
#if !defined(__ZOWE_OS_LINUX) && !defined(__ZOWE_OS_AIX)
void sleep(int secs);
unsigned int sleep(unsigned int);
#endif

/* Set socket tracing; returns prior value */
Expand Down
2 changes: 1 addition & 1 deletion h/dataservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/


typedef int ExternalAPI(void);
typedef int ExternalAPI(struct DataService_tag *,struct HttpServer_tag *);

struct JsonObject_tag;
struct HttpServer_tag;
Expand Down
2 changes: 1 addition & 1 deletion h/metalio.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ typedef struct WPLFlags_tag{
} WPLFlags;


typedef int ntFunction(void);
typedef int ntFunction(int *, ...);

#define NT_CREATE 1
#define NT_RETRIEVE 2
Expand Down
4 changes: 2 additions & 2 deletions h/unixfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -445,13 +445,13 @@ typedef struct F_CVT_tag {
/* Length Values */
#define F_WHENCE_TO_END 0 /* Locked file is from whence to end of the file */

typedef struct F_LOCK_TAG {
typedef struct BpxFLock_Tag {
short l_type;
short l_whence;
int64 l_start;
int64 l_len;
unsigned int l_pid;
} F_LOCK;
} BpxFLock;

int fileDisableConversion(UnixFile *file, int *returnCode, int *reasonCode);
int fileSetLock(UnixFile *file, int *returnCode, int *reasonCode);
Expand Down

0 comments on commit 65c60f1

Please sign in to comment.