mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
shellsync: cleanup package (#8812)
Co-authored-by: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com>
This commit is contained in:
parent
4d99aba7a6
commit
308842ef19
@ -8,7 +8,7 @@ include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/shellsync
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=shellsync
|
||||
TITLE:=Sync shell scripts
|
||||
DEPENDS:=+libpthread +kmod-macvlan
|
||||
endef
|
||||
|
||||
@ -18,7 +18,8 @@ define Build/Prepare
|
||||
endef
|
||||
|
||||
define Package/shellsync/description
|
||||
A tool to sync different shell scripts.Based on syncppp patch by morfast.
|
||||
A tool to sync different shell scripts.
|
||||
Based on syncppp patch by morfast.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
@ -30,5 +31,4 @@ define Package/shellsync/install
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/shellsync $(1)/usr/bin
|
||||
endef
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,shellsync))
|
||||
|
@ -4,15 +4,18 @@
|
||||
> Mail: gch981213@gmail.com
|
||||
> Created Time: 2014年11月06日 星期四 19时15分30秒
|
||||
************************************************************************/
|
||||
#include<stdio.h>
|
||||
#include<semaphore.h>
|
||||
#include<fcntl.h>
|
||||
#include<stdlib.h>
|
||||
#include<time.h>
|
||||
#include<errno.h>
|
||||
#include <stdio.h>
|
||||
#include <semaphore.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define SEM_BLOCK_NAME "SYNCSHELL_block"
|
||||
#define SEM_COUNT_NAME "SYNCSHELL_count"
|
||||
|
||||
int wait_timeout;
|
||||
|
||||
int sync_wait(int nproc)
|
||||
{
|
||||
int flags;
|
||||
@ -32,7 +35,6 @@ int sync_wait(int nproc)
|
||||
}
|
||||
ts.tv_sec += wait_timeout;
|
||||
|
||||
|
||||
flags = O_RDWR | O_CREAT;
|
||||
block = sem_open(SEM_BLOCK_NAME, flags, 0644, 0);
|
||||
count = sem_open(SEM_COUNT_NAME, flags, 0644, 0);
|
||||
@ -50,6 +52,7 @@ int sync_wait(int nproc)
|
||||
return -1;
|
||||
}
|
||||
printf("%d processes have arrived, waiting for the left %d\n", value, nproc-value);
|
||||
|
||||
if (value >= nproc) {
|
||||
while (nproc-1 > 0) {
|
||||
if (sem_post(block) < 0) {
|
||||
@ -67,7 +70,6 @@ int sync_wait(int nproc)
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sem_close(count);
|
||||
|
Loading…
Reference in New Issue
Block a user