From 32e5f4ca2b43c310ff6639320dec2dd52f159f50 Mon Sep 17 00:00:00 2001 From: Qball Cow Date: Wed, 16 Nov 2005 14:43:04 +0000 Subject: DJWLindenaar balanced tree and master process patch git-svn-id: https://svn.musicpd.org/mpd/trunk@3669 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/playerData.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/playerData.c') diff --git a/src/playerData.c b/src/playerData.c index 281453548..060227f4b 100644 --- a/src/playerData.c +++ b/src/playerData.c @@ -34,6 +34,7 @@ int buffered_chunks; #define DEFAULT_BUFFER_BEFORE_PLAY 0 PlayerData * playerData_pd; +int * player_pid; void initPlayerData() { float perc = DEFAULT_BUFFER_BEFORE_PLAY; @@ -102,6 +103,22 @@ void initPlayerData() { ERROR("problems shmctl'ing\n"); exit(EXIT_FAILURE); } + /* maybe the following should be put in the same shm block as the previous + * or maybe even made a part of the playerData struct + */ + allocationSize = sizeof(int); + if((shmid = shmget(IPC_PRIVATE,allocationSize,IPC_CREAT|0600))<0) { + ERROR("problems shmget'ing\n"); + exit(EXIT_FAILURE); + } + if((player_pid = shmat(shmid,NULL,0))<0) { + ERROR("problems shmat'ing\n"); + exit(EXIT_FAILURE); + } + if (shmctl(shmid, IPC_RMID, 0)<0) { + ERROR("problems shmctl'ing\n"); + exit(EXIT_FAILURE); + } buffer = &(playerData_pd->buffer); @@ -147,6 +164,15 @@ PlayerData * getPlayerData() { return playerData_pd; } +int getPlayerPid() { + return *player_pid; +} + +void setPlayerPid(int pid) { + *player_pid = pid; +} + void freePlayerData() { shmdt(playerData_pd); + shmdt(player_pid); } -- cgit v1.2.3